cuelang.org/go@v0.10.1/encoding/jsonschema/testdata/required.txtar (about)

     1  -- schema.json --
     2  {
     3    "$schema": "http://json-schema.org/draft-04/schema#",
     4    "additionalProperties": false,
     5    "id": "https://example.test/example",
     6    "required": ["x", "z"],
     7    "title": "example jsonschema",
     8    "type": "object",
     9    "properties": {
    10      "x": {
    11        "description": "A required field",
    12        "type": "number"
    13      },
    14      "y": {
    15        "description": "An optional field",
    16        "type": "number"
    17      }
    18    }
    19  }
    20  
    21  -- out/decode/cue --
    22  // example jsonschema
    23  @jsonschema(schema="http://json-schema.org/draft-04/schema#")
    24  @jsonschema(id="https://example.test/example")
    25  
    26  // A required field
    27  x!: number
    28  
    29  // An optional field
    30  y?: number
    31  z!: _