-- in.cue --
import "list"

#Arrays: {
	bar?: [...#MyEnum]
	foo?: [...#MyStruct]

	baz?: list.UniqueItems()

	qux?: list.MinItems(1) & list.MaxItems(3)

	closedConcreteList?: [1, 2, 3]
	openConcreteList?: [1, 2, 3, ...]
}

#Arrays: {
	bar?: [...#MyEnum]
	foo?: [...#MyStruct]
}

// MyStruct
#MyStruct: {
	a?: int
	e?: [...#MyEnum]
	e?: [...#MyEnum]
}

// MyEnum
#MyEnum: *"1" | "2" | "3"

-- out/TestGenerateOpenAPI/out.json --
{
   "openapi": "3.0.0",
   "info": {
      "title": "Generated by cue.",
      "version": "no version"
   },
   "paths": {},
   "components": {
      "schemas": {
         "Arrays": {
            "type": "object",
            "properties": {
               "bar": {
                  "type": "array",
                  "items": {
                     "$ref": "#/components/schemas/MyEnum"
                  }
               },
               "foo": {
                  "type": "array",
                  "items": {
                     "$ref": "#/components/schemas/MyStruct"
                  }
               },
               "baz": {
                  "type": "array",
                  "uniqueItems": true
               },
               "qux": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 3
               },
               "closedConcreteList": {
                  "type": "array",
                  "items": [
                     {
                        "type": "integer",
                        "enum": [
                           1
                        ]
                     },
                     {
                        "type": "integer",
                        "enum": [
                           2
                        ]
                     },
                     {
                        "type": "integer",
                        "enum": [
                           3
                        ]
                     }
                  ],
                  "default": [
                     1,
                     2,
                     3
                  ]
               },
               "openConcreteList": {
                  "type": "array",
                  "minItems": 3,
                  "items": [
                     {
                        "type": "integer",
                        "enum": [
                           1
                        ]
                     },
                     {
                        "type": "integer",
                        "enum": [
                           2
                        ]
                     },
                     {
                        "type": "integer",
                        "enum": [
                           3
                        ]
                     }
                  ],
                  "default": [
                     1,
                     2,
                     3
                  ],
                  "additionalItems": {}
               }
            }
         },
         "MyEnum": {
            "description": "MyEnum",
            "type": "string",
            "enum": [
               "1",
               "2",
               "3"
            ],
            "default": "1"
         },
         "MyStruct": {
            "description": "MyStruct",
            "type": "object",
            "properties": {
               "a": {
                  "type": "integer"
               },
               "e": {
                  "type": "array",
                  "items": {
                     "$ref": "#/components/schemas/MyEnum"
                  }
               }
            }
         }
      }
   }
}