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

     1  #NameFunc: excludeExcluded
     2  -- in.cue --
     3  #Keep: {
     4  	// This comment is included
     5  	excludedStruct: #ExcludedStruct
     6  	excludedInt:    #ExcludedInt
     7  }
     8  
     9  // ExcludedStruct is not included in the output.
    10  #ExcludedStruct: {
    11  	A: int
    12  }
    13  
    14  // ExcludedInt is not included in the output.
    15  #ExcludedInt: int
    16  
    17  #Type: {
    18  	a?: string
    19  	#BaseType
    20  }
    21  #BaseType: {
    22  	b: string
    23  }
    24  
    25  -- out/TestGenerateOpenAPI/out.json --
    26  {
    27     "openapi": "3.0.0",
    28     "info": {
    29        "title": "Generated by cue.",
    30        "version": "no version"
    31     },
    32     "paths": {},
    33     "components": {
    34        "schemas": {
    35           "BaseType": {
    36              "type": "object",
    37              "required": [
    38                 "b"
    39              ],
    40              "properties": {
    41                 "b": {
    42                    "type": "string"
    43                 }
    44              }
    45           },
    46           "Keep": {
    47              "type": "object",
    48              "required": [
    49                 "excludedStruct",
    50                 "excludedInt"
    51              ],
    52              "properties": {
    53                 "excludedStruct": {
    54                    "description": "This comment is included",
    55                    "type": "object",
    56                    "required": [
    57                       "A"
    58                    ],
    59                    "properties": {
    60                       "A": {
    61                          "type": "integer"
    62                       }
    63                    }
    64                 },
    65                 "excludedInt": {
    66                    "type": "integer"
    67                 }
    68              }
    69           },
    70           "Type": {
    71              "type": "object",
    72              "properties": {
    73                 "a": {
    74                    "type": "string"
    75                 }
    76              },
    77              "allOf": [
    78                 {
    79                    "$ref": "#/components/schemas/BaseType"
    80                 }
    81              ]
    82           }
    83        }
    84     }
    85  }