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

     1  [
     2      {
     3          "description": "contains keyword validation",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/2020-12/schema",
     6              "contains": {"minimum": 5}
     7          },
     8          "tests": [
     9              {
    10                  "description": "array with item matching schema (5) is valid",
    11                  "data": [3, 4, 5],
    12                  "valid": true
    13              },
    14              {
    15                  "description": "array with item matching schema (6) is valid",
    16                  "data": [3, 4, 6],
    17                  "valid": true
    18              },
    19              {
    20                  "description": "array with two items matching schema (5, 6) is valid",
    21                  "data": [3, 4, 5, 6],
    22                  "valid": true
    23              },
    24              {
    25                  "description": "array without items matching schema is invalid",
    26                  "data": [2, 3, 4],
    27                  "valid": false
    28              },
    29              {
    30                  "description": "empty array is invalid",
    31                  "data": [],
    32                  "valid": false
    33              },
    34              {
    35                  "description": "not array is valid",
    36                  "data": {},
    37                  "valid": true
    38              }
    39          ]
    40      },
    41      {
    42          "description": "contains keyword with const keyword",
    43          "schema": {
    44              "$schema": "https://json-schema.org/draft/2020-12/schema",
    45              "contains": { "const": 5 }
    46          },
    47          "tests": [
    48              {
    49                  "description": "array with item 5 is valid",
    50                  "data": [3, 4, 5],
    51                  "valid": true
    52              },
    53              {
    54                  "description": "array with two items 5 is valid",
    55                  "data": [3, 4, 5, 5],
    56                  "valid": true
    57              },
    58              {
    59                  "description": "array without item 5 is invalid",
    60                  "data": [1, 2, 3, 4],
    61                  "valid": false
    62              }
    63          ]
    64      },
    65      {
    66          "description": "contains keyword with boolean schema true",
    67          "schema": {
    68              "$schema": "https://json-schema.org/draft/2020-12/schema",
    69              "contains": true
    70          },
    71          "tests": [
    72              {
    73                  "description": "any non-empty array is valid",
    74                  "data": ["foo"],
    75                  "valid": true
    76              },
    77              {
    78                  "description": "empty array is invalid",
    79                  "data": [],
    80                  "valid": false
    81              }
    82          ]
    83      },
    84      {
    85          "description": "contains keyword with boolean schema false",
    86          "schema": {
    87              "$schema": "https://json-schema.org/draft/2020-12/schema",
    88              "contains": false
    89          },
    90          "tests": [
    91              {
    92                  "description": "any non-empty array is invalid",
    93                  "data": ["foo"],
    94                  "valid": false
    95              },
    96              {
    97                  "description": "empty array is invalid",
    98                  "data": [],
    99                  "valid": false
   100              },
   101              {
   102                  "description": "non-arrays are valid",
   103                  "data": "contains does not apply to strings",
   104                  "valid": true
   105              }
   106          ]
   107      },
   108      {
   109          "description": "items + contains",
   110          "schema": {
   111              "$schema": "https://json-schema.org/draft/2020-12/schema",
   112              "items": { "multipleOf": 2 },
   113              "contains": { "multipleOf": 3 }
   114          },
   115          "tests": [
   116              {
   117                  "description": "matches items, does not match contains",
   118                  "data": [ 2, 4, 8 ],
   119                  "valid": false
   120              },
   121              {
   122                  "description": "does not match items, matches contains",
   123                  "data": [ 3, 6, 9 ],
   124                  "valid": false
   125              },
   126              {
   127                  "description": "matches both items and contains",
   128                  "data": [ 6, 12 ],
   129                  "valid": true
   130              },
   131              {
   132                  "description": "matches neither items nor contains",
   133                  "data": [ 1, 5 ],
   134                  "valid": false
   135              }
   136          ]
   137      },
   138      {
   139          "description": "contains with false if subschema",
   140          "schema": {
   141              "$schema": "https://json-schema.org/draft/2020-12/schema",
   142              "contains": {
   143                  "if": false,
   144                  "else": true
   145              }
   146          },
   147          "tests": [
   148              {
   149                  "description": "any non-empty array is valid",
   150                  "data": ["foo"],
   151                  "valid": true
   152              },
   153              {
   154                  "description": "empty array is invalid",
   155                  "data": [],
   156                  "valid": false
   157              }
   158          ]
   159      },
   160      {
   161          "description": "contains with null instance elements",
   162          "schema": {
   163              "$schema": "https://json-schema.org/draft/2020-12/schema",
   164              "contains": {
   165                  "type": "null"
   166              }
   167          },
   168          "tests": [
   169              {
   170                  "description": "allows null items",
   171                  "data": [ null ],
   172                  "valid": true
   173              }
   174          ]
   175      }
   176  ]