github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft3/patternProperties.json (about)

     1  [
     2      {
     3          "description":
     4              "patternProperties validates properties matching a regex",
     5          "schema": {
     6              "patternProperties": {
     7                  "f.*o": {"type": "integer"}
     8              }
     9          },
    10          "tests": [
    11              {
    12                  "description": "a single valid match is valid",
    13                  "data": {"foo": 1},
    14                  "valid": true
    15              },
    16              {
    17                  "description": "multiple valid matches is valid",
    18                  "data": {"foo": 1, "foooooo" : 2},
    19                  "valid": true
    20              },
    21              {
    22                  "description": "a single invalid match is invalid",
    23                  "data": {"foo": "bar", "fooooo": 2},
    24                  "valid": false
    25              },
    26              {
    27                  "description": "multiple invalid matches is invalid",
    28                  "data": {"foo": "bar", "foooooo" : "baz"},
    29                  "valid": false
    30              },
    31              {
    32                  "description": "ignores arrays",
    33                  "data": [],
    34                  "valid": true
    35              },
    36              {
    37                  "description": "ignores other non-objects",
    38                  "data": 12,
    39                  "valid": true
    40              }
    41          ]
    42      },
    43      {
    44          "description": "multiple simultaneous patternProperties are validated",
    45          "schema": {
    46              "patternProperties": {
    47                  "a*": {"type": "integer"},
    48                  "aaa*": {"maximum": 20}
    49              }
    50          },
    51          "tests": [
    52              {
    53                  "description": "a single valid match is valid",
    54                  "data": {"a": 21},
    55                  "valid": true
    56              },
    57              {
    58                  "description": "a simultaneous match is valid",
    59                  "data": {"aaaa": 18},
    60                  "valid": true
    61              },
    62              {
    63                  "description": "multiple matches is valid",
    64                  "data": {"a": 21, "aaaa": 18},
    65                  "valid": true
    66              },
    67              {
    68                  "description": "an invalid due to one is invalid",
    69                  "data": {"a": "bar"},
    70                  "valid": false
    71              },
    72              {
    73                  "description": "an invalid due to the other is invalid",
    74                  "data": {"aaaa": 31},
    75                  "valid": false
    76              },
    77              {
    78                  "description": "an invalid due to both is invalid",
    79                  "data": {"aaa": "foo", "aaaa": 31},
    80                  "valid": false
    81              }
    82          ]
    83      },
    84      {
    85          "description": "regexes are not anchored by default and are case sensitive",
    86          "schema": {
    87              "patternProperties": {
    88                  "[0-9]{2,}": { "type": "boolean" },
    89                  "X_": { "type": "string" }
    90              }
    91          },
    92          "tests": [
    93              {
    94                  "description": "non recognized members are ignored",
    95                  "data": { "answer 1": "42" },
    96                  "valid": true
    97              },
    98              {
    99                  "description": "recognized members are accounted for",
   100                  "data": { "a31b": null },
   101                  "valid": false
   102              },
   103              {
   104                  "description": "regexes are case sensitive",
   105                  "data": { "a_x_3": 3 },
   106                  "valid": true
   107              },
   108              {
   109                  "description": "regexes are case sensitive, 2",
   110                  "data": { "a_X_3": 3 },
   111                  "valid": false
   112              }
   113          ]
   114      },
   115      {
   116          "description": "patternProperties with null valued instance properties",
   117          "schema": {
   118              "patternProperties": {
   119                  "^.*bar$": {"type": "null"}
   120              }
   121          },
   122          "tests": [
   123              {
   124                  "description": "allows null values",
   125                  "data": {"foobar": null},
   126                  "valid": true
   127              }
   128          ]
   129      }
   130  ]