cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/contains.txtar (about)

     1  -- schema.yaml --
     2  $schema: "https://json-schema.org/draft/2019-09/schema"
     3  type: object
     4  
     5  properties:
     6    p1:
     7      type: array
     8      contains: {}
     9  
    10    p2:
    11      type: array
    12      contains: {}
    13      minContains: 0
    14  
    15    p3:
    16      type: array
    17      contains: {}
    18      maxContains: 6
    19  
    20    p4:
    21      type: array
    22      contains: {}
    23      minContains: 3
    24      maxContains: 6
    25  
    26    # If "contains" is not present within the same schema object, then this keyword has no effect.
    27    p5:
    28      type: array
    29      minContains: 6
    30    p6:
    31      type: array
    32      maxContains: 6
    33  
    34  additionalProperties: false
    35  
    36  -- out/decode/extract --
    37  import "list"
    38  
    39  @jsonschema(schema="https://json-schema.org/draft/2019-09/schema")
    40  
    41  close({
    42  	p1?: list.MatchN(>=1, _)
    43  	p2?: list.MatchN(>=0, _)
    44  	p3?: list.MatchN(>=1 & <=6, _)
    45  	p4?: list.MatchN(>=3 & <=6, _)
    46  	p5?: [...]
    47  	p6?: [...]
    48  })