cuelang.org/go@v0.13.0/encoding/openapi/testdata/nested.txtar (about)

     1  -- in.cue --
     2  // File comment.
     3  
     4  #Struct: {
     5  	#T: int
     6  
     7  	a?: #T
     8  
     9  	{b?: #T}
    10  
    11  	c?: [...#T]
    12  }
    13  
    14  -- out/TestGenerateOpenAPI/out.json --
    15  {
    16     "openapi": "3.0.0",
    17     "info": {
    18        "title": "File comment.",
    19        "version": "no version"
    20     },
    21     "paths": {},
    22     "components": {
    23        "schemas": {
    24           "Struct": {
    25              "type": "object",
    26              "properties": {
    27                 "b": {
    28                    "$ref": "#/components/schemas/Struct.T"
    29                 },
    30                 "a": {
    31                    "$ref": "#/components/schemas/Struct.T"
    32                 },
    33                 "c": {
    34                    "type": "array",
    35                    "items": {
    36                       "$ref": "#/components/schemas/Struct.T"
    37                    }
    38                 }
    39              }
    40           },
    41           "Struct.T": {
    42              "type": "integer"
    43           }
    44        }
    45     }
    46  }