[
  {
    "description": "contains keyword validation",
    "database": {
      "schemas": [
        {
          "contains": {
            "minimum": 5
          },
          "items": true,
          "$id": "contains_0_0"
        }
      ]
    },
    "tests": [
      {
        "description": "array with item matching schema (5) is valid (items: true)",
        "data": [
          3,
          4,
          5
        ],
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "array with item matching schema (6) is valid (items: true)",
        "data": [
          3,
          4,
          6
        ],
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "array with two items matching schema (5, 6) is valid (items: true)",
        "data": [
          3,
          4,
          5,
          6
        ],
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "array without items matching schema is invalid",
        "data": [
          2,
          3,
          4
        ],
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "empty array is invalid",
        "data": [],
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "not array is valid",
        "data": {},
        "schema_id": "contains_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "contains keyword with const keyword",
    "database": {
      "schemas": [
        {
          "contains": {
            "const": 5
          },
          "items": true,
          "$id": "contains_1_0"
        }
      ]
    },
    "tests": [
      {
        "description": "array with item 5 is valid (items: true)",
        "data": [
          3,
          4,
          5
        ],
        "schema_id": "contains_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "array with two items 5 is valid (items: true)",
        "data": [
          3,
          4,
          5,
          5
        ],
        "schema_id": "contains_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "array without item 5 is invalid",
        "data": [
          1,
          2,
          3,
          4
        ],
        "schema_id": "contains_1_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "contains keyword with boolean schema true",
    "database": {
      "schemas": [
        {
          "contains": true,
          "$id": "contains_2_0"
        }
      ]
    },
    "tests": [
      {
        "description": "any non-empty array is valid",
        "data": [
          "foo"
        ],
        "schema_id": "contains_2_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "empty array is invalid",
        "data": [],
        "schema_id": "contains_2_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "contains keyword with boolean schema false",
    "database": {
      "schemas": [
        {
          "contains": false,
          "$id": "contains_3_0"
        }
      ]
    },
    "tests": [
      {
        "description": "any non-empty array is invalid",
        "data": [
          "foo"
        ],
        "schema_id": "contains_3_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "empty array is invalid",
        "data": [],
        "schema_id": "contains_3_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "non-arrays are valid",
        "data": "contains does not apply to strings",
        "schema_id": "contains_3_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "items + contains",
    "database": {
      "schemas": [
        {
          "items": {
            "multipleOf": 2
          },
          "contains": {
            "multipleOf": 3
          },
          "$id": "contains_4_0"
        }
      ]
    },
    "tests": [
      {
        "description": "matches items, does not match contains",
        "data": [
          2,
          4,
          8
        ],
        "schema_id": "contains_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "does not match items, matches contains",
        "data": [
          3,
          6,
          9
        ],
        "schema_id": "contains_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "matches both items and contains",
        "data": [
          6,
          12
        ],
        "schema_id": "contains_4_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "matches neither items nor contains",
        "data": [
          1,
          5
        ],
        "schema_id": "contains_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "contains with false if subschema",
    "database": {
      "schemas": [
        {
          "contains": {
            "if": false,
            "else": true
          },
          "$id": "contains_5_0"
        }
      ]
    },
    "tests": [
      {
        "description": "any non-empty array is valid",
        "data": [
          "foo"
        ],
        "schema_id": "contains_5_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "empty array is invalid",
        "data": [],
        "schema_id": "contains_5_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "contains with null instance elements",
    "database": {
      "schemas": [
        {
          "contains": {
            "type": "null"
          },
          "$id": "contains_6_0"
        }
      ]
    },
    "tests": [
      {
        "description": "allows null items",
        "data": [
          null
        ],
        "schema_id": "contains_6_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "extensible: true allows non-matching items in contains",
    "database": {
      "schemas": [
        {
          "contains": {
            "const": 1
          },
          "extensible": true,
          "$id": "contains_7_0"
        }
      ]
    },
    "tests": [
      {
        "description": "extra items acceptable",
        "data": [
          1,
          2
        ],
        "schema_id": "contains_7_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "strict by default: non-matching items in contains are invalid",
    "database": {
      "schemas": [
        {
          "contains": {
            "const": 1
          },
          "$id": "contains_8_0"
        }
      ]
    },
    "tests": [
      {
        "description": "extra items cause failure",
        "data": [
          1,
          2
        ],
        "schema_id": "contains_8_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "only matching items is valid",
        "data": [
          1,
          1
        ],
        "schema_id": "contains_8_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  }
]