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

     1  Check that fields are quoted correctly if they are named after
     2  the matchN builtin.
     3  
     4  -- schema.json --
     5  {
     6      "type": "object",
     7      "properties": {
     8          "matchN": {
     9              "oneOf": [
    10                  {
    11                      "const": 1
    12                  },
    13                  {
    14                      "const": 2
    15                  }
    16              ]
    17          }
    18      }
    19  }
    20  -- out/decode/extract --
    21  "matchN"?: matchN(1, [1, 2])
    22  ...
    23  -- test/ok1.json --
    24  {"matchN": 1}
    25  -- test/ok2.json --
    26  {"matchN": 2}
    27  -- test/err-nomatch.json --
    28  {"matchN": 3}
    29  -- out/decode/testerr/err-nomatch --
    30  matchN: conflicting values 1 and 3:
    31      generated.cue:1:23
    32      test/err-nomatch.json:1:12
    33  matchN: conflicting values 2 and 3:
    34      generated.cue:1:26
    35      test/err-nomatch.json:1:12
    36  matchN: invalid value 3 (does not satisfy matchN): 0 matched, expected 1:
    37      generated.cue:1:12
    38      generated.cue:1:19
    39      test/err-nomatch.json:1:12