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

     1  # This tests the case where there's a patternProperties keyword
     2  # and fields that contain regexp metacharacters.
     3  
     4  # TODO the field test should fail but currently does not.
     5  
     6  -- schema.json --
     7  {
     8      "$schema": "http://json-schema.org/draft-07/schema#",
     9      "type": "object",
    10      "properties": {
    11          "c.e": {
    12              "type": "boolean"
    13          }
    14      },
    15      "patternProperties": {
    16          ".*": {
    17              "type": "string"
    18          }
    19      }
    20  }
    21  -- out/decode/extract --
    22  @jsonschema(schema="http://json-schema.org/draft-07/schema#")
    23  "c.e"?: bool
    24  
    25  {[=~".*" & !~"^(c\\.e)$"]: string}
    26  ...
    27  -- test/err-field.json --
    28  {
    29      "cue": 123
    30  }
    31  -- out/decode/testerr/err-field --
    32  cue: conflicting values 123 and string (mismatched types int and string):
    33      generated.cue:4:1
    34      generated.cue:4:28
    35      test/err-field.json:2:12