[
  {
    "description": "const validation",
    "database": {
      "schemas": [
        {
          "const": 2,
          "$id": "const_0_0"
        }
      ]
    },
    "tests": [
      {
        "description": "same value is valid",
        "data": 2,
        "schema_id": "const_0_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "another value is invalid",
        "data": 5,
        "schema_id": "const_0_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "another type is invalid",
        "data": "a",
        "schema_id": "const_0_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with object",
    "database": {
      "schemas": [
        {
          "const": {
            "foo": "bar",
            "baz": "bax"
          },
          "properties": {
            "foo": {},
            "baz": {}
          },
          "$id": "const_1_0"
        }
      ]
    },
    "tests": [
      {
        "description": "same object is valid",
        "data": {
          "foo": "bar",
          "baz": "bax"
        },
        "schema_id": "const_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "same object with different property order is valid",
        "data": {
          "baz": "bax",
          "foo": "bar"
        },
        "schema_id": "const_1_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "another object is invalid",
        "data": {
          "foo": "bar"
        },
        "schema_id": "const_1_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "another type is invalid",
        "data": [
          1,
          2
        ],
        "schema_id": "const_1_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with array",
    "database": {
      "schemas": [
        {
          "const": [
            {
              "foo": "bar"
            }
          ],
          "$id": "const_2_0"
        }
      ]
    },
    "tests": [
      {
        "description": "same array is valid",
        "data": [
          {
            "foo": "bar"
          }
        ],
        "schema_id": "const_2_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "another array item is invalid",
        "data": [
          2
        ],
        "schema_id": "const_2_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "array with additional items is invalid",
        "data": [
          1,
          2,
          3
        ],
        "schema_id": "const_2_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with null",
    "database": {
      "schemas": [
        {
          "const": null,
          "$id": "const_3_0"
        }
      ]
    },
    "tests": [
      {
        "description": "null is valid",
        "data": null,
        "schema_id": "const_3_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "not null is invalid",
        "data": 0,
        "schema_id": "const_3_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with false does not match 0",
    "database": {
      "schemas": [
        {
          "const": false,
          "$id": "const_4_0"
        }
      ]
    },
    "tests": [
      {
        "description": "false is valid",
        "data": false,
        "schema_id": "const_4_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "integer zero is invalid",
        "data": 0,
        "schema_id": "const_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "float zero is invalid",
        "data": 0,
        "schema_id": "const_4_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with true does not match 1",
    "database": {
      "schemas": [
        {
          "const": true,
          "$id": "const_5_0"
        }
      ]
    },
    "tests": [
      {
        "description": "true is valid",
        "data": true,
        "schema_id": "const_5_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "integer one is invalid",
        "data": 1,
        "schema_id": "const_5_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "float one is invalid",
        "data": 1,
        "schema_id": "const_5_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with [false] does not match [0]",
    "database": {
      "schemas": [
        {
          "const": [
            false
          ],
          "$id": "const_6_0"
        }
      ]
    },
    "tests": [
      {
        "description": "[false] is valid",
        "data": [
          false
        ],
        "schema_id": "const_6_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "[0] is invalid",
        "data": [
          0
        ],
        "schema_id": "const_6_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "[0.0] is invalid",
        "data": [
          0
        ],
        "schema_id": "const_6_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with [true] does not match [1]",
    "database": {
      "schemas": [
        {
          "const": [
            true
          ],
          "$id": "const_7_0"
        }
      ]
    },
    "tests": [
      {
        "description": "[true] is valid",
        "data": [
          true
        ],
        "schema_id": "const_7_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "[1] is invalid",
        "data": [
          1
        ],
        "schema_id": "const_7_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "[1.0] is invalid",
        "data": [
          1
        ],
        "schema_id": "const_7_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with {\"a\": false} does not match {\"a\": 0}",
    "database": {
      "schemas": [
        {
          "const": {
            "a": false
          },
          "$id": "const_8_0"
        }
      ]
    },
    "tests": [
      {
        "description": "{\"a\": false} is valid",
        "data": {
          "a": false
        },
        "schema_id": "const_8_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "{\"a\": 0} is invalid",
        "data": {
          "a": 0
        },
        "schema_id": "const_8_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "{\"a\": 0.0} is invalid",
        "data": {
          "a": 0
        },
        "schema_id": "const_8_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with {\"a\": true} does not match {\"a\": 1}",
    "database": {
      "schemas": [
        {
          "const": {
            "a": true
          },
          "$id": "const_9_0"
        }
      ]
    },
    "tests": [
      {
        "description": "{\"a\": true} is valid",
        "data": {
          "a": true
        },
        "schema_id": "const_9_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "{\"a\": 1} is invalid",
        "data": {
          "a": 1
        },
        "schema_id": "const_9_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "{\"a\": 1.0} is invalid",
        "data": {
          "a": 1
        },
        "schema_id": "const_9_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with 0 does not match other zero-like types",
    "database": {
      "schemas": [
        {
          "const": 0,
          "$id": "const_10_0"
        }
      ]
    },
    "tests": [
      {
        "description": "false is invalid",
        "data": false,
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "integer zero is valid",
        "data": 0,
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "float zero is valid",
        "data": 0,
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "empty object is invalid",
        "data": {},
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "empty array is invalid",
        "data": [],
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "empty string is invalid",
        "data": "",
        "schema_id": "const_10_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "const with 1 does not match true",
    "database": {
      "schemas": [
        {
          "const": 1,
          "$id": "const_11_0"
        }
      ]
    },
    "tests": [
      {
        "description": "true is invalid",
        "data": true,
        "schema_id": "const_11_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "integer one is valid",
        "data": 1,
        "schema_id": "const_11_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "float one is valid",
        "data": 1,
        "schema_id": "const_11_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  },
  {
    "description": "const with -2.0 matches integer and float types",
    "database": {
      "schemas": [
        {
          "const": -2,
          "$id": "const_12_0"
        }
      ]
    },
    "tests": [
      {
        "description": "integer -2 is valid",
        "data": -2,
        "schema_id": "const_12_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "integer 2 is invalid",
        "data": 2,
        "schema_id": "const_12_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "float -2.0 is valid",
        "data": -2,
        "schema_id": "const_12_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "float 2.0 is invalid",
        "data": 2,
        "schema_id": "const_12_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "float -2.00001 is invalid",
        "data": -2.00001,
        "schema_id": "const_12_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "float and integers are equal up to 64-bit representation limits",
    "database": {
      "schemas": [
        {
          "const": 9007199254740992,
          "$id": "const_13_0"
        }
      ]
    },
    "tests": [
      {
        "description": "integer is valid",
        "data": 9007199254740992,
        "schema_id": "const_13_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "integer minus one is invalid",
        "data": 9007199254740991,
        "schema_id": "const_13_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "float is valid",
        "data": 9007199254740992,
        "schema_id": "const_13_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "float minus one is invalid",
        "data": 9007199254740991,
        "schema_id": "const_13_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "nul characters in strings",
    "database": {
      "schemas": [
        {
          "const": "hello\u0000there",
          "$id": "const_14_0"
        }
      ]
    },
    "tests": [
      {
        "description": "match string with nul",
        "data": "hello\u0000there",
        "schema_id": "const_14_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "do not match string lacking nul",
        "data": "hellothere",
        "schema_id": "const_14_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "characters with the same visual representation but different codepoint",
    "database": {
      "schemas": [
        {
          "const": "μ",
          "$comment": "U+03BC",
          "$id": "const_15_0"
        }
      ]
    },
    "tests": [
      {
        "description": "character uses the same codepoint",
        "data": "μ",
        "comment": "U+03BC",
        "schema_id": "const_15_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "character looks the same but uses a different codepoint",
        "data": "µ",
        "comment": "U+00B5",
        "schema_id": "const_15_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "characters with the same visual representation, but different number of codepoints",
    "database": {
      "schemas": [
        {
          "const": "ä",
          "$comment": "U+00E4",
          "$id": "const_16_0"
        }
      ]
    },
    "tests": [
      {
        "description": "character uses the same codepoint",
        "data": "ä",
        "comment": "U+00E4",
        "schema_id": "const_16_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      },
      {
        "description": "character looks the same but uses combining marks",
        "data": "ä",
        "comment": "a, U+0308",
        "schema_id": "const_16_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      }
    ]
  },
  {
    "description": "extensible: true allows extra properties in const object match",
    "database": {
      "schemas": [
        {
          "const": {
            "a": 1
          },
          "extensible": true,
          "$id": "const_17_0"
        }
      ]
    },
    "tests": [
      {
        "description": "extra property ignored during strict check, but const check still applies (mismatch)",
        "data": {
          "a": 1,
          "b": 2
        },
        "schema_id": "const_17_0",
        "action": "validate",
        "expect": {
          "success": false
        }
      },
      {
        "description": "extra property match in const (this is effectively impossible if data has extra props not in const, it implicitly fails const check unless we assume const check ignored extra props? No, const check is strict. So this test is just to show strictness passes.)",
        "data": {
          "a": 1
        },
        "schema_id": "const_17_0",
        "action": "validate",
        "expect": {
          "success": true
        }
      }
    ]
  }
]