-- schema.yaml --
$schema: http://json-schema.org/draft-07/schema#
type: object

properties:
  foo:
    type: array
    items:
      type: string

  tuple:
    type: array
    items:
      - type: string
      - type: integer
      - const: 2

  has:
    type: array
    contains:
      const: 3

  too:
    type: array
    contains:
      type: string

  size:
    type: array
    minItems: 3
    maxItems: 9
    uniqueItems: true

  additional:
    type: array
    items:
      - type: integer
      - type: integer
    additionalItems:
      type: string

additionalProperties: false

-- out/decode/extract --
import "list"

@jsonschema(schema="http://json-schema.org/draft-07/schema#")

close({
	foo?: [...string]
	tuple?: [string, int, 2, ...]
	has?: list.MatchN(>=1, 3)
	too?: list.MatchN(>=1, string)
	size?: list.MaxItems(9) & list.UniqueItems() & [_, _, _, ...]
	additional?: [int, int, ...string]
})
-- out/decode/testerr/err-foo-not-string --
foo.0: conflicting values true and string (mismatched types bool and string):
    generated.cue:5:1
    generated.cue:6:9
    generated.cue:6:12
    test/err-foo-not-string.json:2:10
-- test/empty.json --
{}
-- test/foo-items.json --
{
	"foo": ["x", "y"]
}
-- test/err-foo-not-string.json --
{
	"foo": [true]
}
