From 5d0eb5e874922df6e24b9478d09528bea66e3d29 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:09:45 +0000 Subject: [PATCH 01/11] contrib: guard compile CLI with is_schema to prevent abort on invalid input Signed-off-by: Vaibhav mittal --- contrib/compile.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contrib/compile.cc b/contrib/compile.cc index a98941e7b..82699d8a9 100644 --- a/contrib/compile.cc +++ b/contrib/compile.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include #include // std::chrono @@ -131,6 +132,14 @@ auto main(int argc, char **argv) noexcept -> int { sourcemeta::core::read_json(std::filesystem::path{positional.front()})}; std::cerr << "Input: " << positional.front() << "\n"; + // The compiler assumes valid schema input (object or boolean) and + // asserts otherwise. Guard here at the CLI boundary to ensure + // graceful failure instead of aborting on malformed inputs. + if (!sourcemeta::core::is_schema(document)) { + std::cerr << "error: the input is not a valid JSON Schema\n"; + return EXIT_FAILURE; + } + if (options.contains("path")) { const auto pointer{sourcemeta::core::to_pointer( std::string{options.at("path").front()})}; @@ -143,6 +152,12 @@ auto main(int argc, char **argv) noexcept -> int { auto extracted{*result}; document = std::move(extracted); + + if (!sourcemeta::core::is_schema(document)) { + std::cerr << "error: the value at the given path is not a valid " + "JSON Schema\n"; + return EXIT_FAILURE; + } } const auto compile_start{std::chrono::high_resolution_clock::now()}; From 316016120235eb38d9c771bc5fe81027f8af0353 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:10:54 +0000 Subject: [PATCH 02/11] test: add initial valid schema corpus for compile binary Signed-off-by: Vaibhav mittal --- .../compile/valid/array_constraints.json | 13 ++++++++ test/corpus/compile/valid/combinators.json | 18 +++++++++++ test/corpus/compile/valid/complex_object.json | 30 +++++++++++++++++++ test/corpus/compile/valid/conditional.json | 13 ++++++++ test/corpus/compile/valid/draft2019.json | 19 ++++++++++++ test/corpus/compile/valid/draft2020.json | 18 +++++++++++ test/corpus/compile/valid/draft4.json | 10 +++++++ test/corpus/compile/valid/draft6.json | 9 ++++++ test/corpus/compile/valid/draft7.json | 10 +++++++ test/corpus/compile/valid/not_keyword.json | 6 ++++ .../compile/valid/numeric_constraints.json | 9 ++++++ test/corpus/compile/valid/openapi_3_1.json | 9 ++++++ test/corpus/compile/valid/openapi_3_2.json | 9 ++++++ .../compile/valid/pattern_properties.json | 9 ++++++ test/corpus/compile/valid/properties.json | 9 ++++++ test/corpus/compile/valid/refs_and_defs.json | 17 +++++++++++ .../compile/valid/string_constraints.json | 7 +++++ test/corpus/compile/valid/type_array.json | 4 +++ test/corpus/compile/valid/type_string.json | 4 +++ 19 files changed, 223 insertions(+) create mode 100644 test/corpus/compile/valid/array_constraints.json create mode 100644 test/corpus/compile/valid/combinators.json create mode 100644 test/corpus/compile/valid/complex_object.json create mode 100644 test/corpus/compile/valid/conditional.json create mode 100644 test/corpus/compile/valid/draft2019.json create mode 100644 test/corpus/compile/valid/draft2020.json create mode 100644 test/corpus/compile/valid/draft4.json create mode 100644 test/corpus/compile/valid/draft6.json create mode 100644 test/corpus/compile/valid/draft7.json create mode 100644 test/corpus/compile/valid/not_keyword.json create mode 100644 test/corpus/compile/valid/numeric_constraints.json create mode 100644 test/corpus/compile/valid/openapi_3_1.json create mode 100644 test/corpus/compile/valid/openapi_3_2.json create mode 100644 test/corpus/compile/valid/pattern_properties.json create mode 100644 test/corpus/compile/valid/properties.json create mode 100644 test/corpus/compile/valid/refs_and_defs.json create mode 100644 test/corpus/compile/valid/string_constraints.json create mode 100644 test/corpus/compile/valid/type_array.json create mode 100644 test/corpus/compile/valid/type_string.json diff --git a/test/corpus/compile/valid/array_constraints.json b/test/corpus/compile/valid/array_constraints.json new file mode 100644 index 000000000..3ffacc0f2 --- /dev/null +++ b/test/corpus/compile/valid/array_constraints.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "prefixItems": [ + { "type": "string" }, + { "type": "integer" } + ], + "items": { "type": "boolean" }, + "minItems": 1, + "maxItems": 10, + "uniqueItems": true, + "contains": { "type": "string" } +} diff --git a/test/corpus/compile/valid/combinators.json b/test/corpus/compile/valid/combinators.json new file mode 100644 index 000000000..1e71d67cc --- /dev/null +++ b/test/corpus/compile/valid/combinators.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "allOf": [ + { "type": "object" }, + { + "anyOf": [ + { "required": ["a"] }, + { "required": ["b"] } + ] + }, + { + "oneOf": [ + { "properties": { "x": { "type": "string" } } }, + { "properties": { "x": { "type": "number" } } } + ] + } + ] +} diff --git a/test/corpus/compile/valid/complex_object.json b/test/corpus/compile/valid/complex_object.json new file mode 100644 index 000000000..c2c2662f4 --- /dev/null +++ b/test/corpus/compile/valid/complex_object.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { "type": "string", "minLength": 1, "maxLength": 100 }, + "age": { "type": "integer", "minimum": 0, "maximum": 150 }, + "email": { "type": "string", "format": "email" }, + "address": { + "type": "object", + "properties": { + "street": { "type": "string" }, + "city": { "type": "string" }, + "zip": { "type": "string", "pattern": "^[0-9]{5}$" } + }, + "required": ["street", "city"] + }, + "tags": { + "type": "array", + "items": { "type": "string" }, + "minItems": 0, + "maxItems": 20, + "uniqueItems": true + }, + "role": { + "enum": ["admin", "user", "guest"] + } + }, + "required": ["name", "email"], + "additionalProperties": false +} diff --git a/test/corpus/compile/valid/conditional.json b/test/corpus/compile/valid/conditional.json new file mode 100644 index 000000000..e139a29c9 --- /dev/null +++ b/test/corpus/compile/valid/conditional.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "if": { + "properties": { "kind": { "const": "a" } } + }, + "then": { + "required": ["value_a"] + }, + "else": { + "required": ["value_b"] + } +} diff --git a/test/corpus/compile/valid/draft2019.json b/test/corpus/compile/valid/draft2019.json new file mode 100644 index 000000000..a8f945a34 --- /dev/null +++ b/test/corpus/compile/valid/draft2019.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "type": "object", + "properties": { + "name": { "type": "string" }, + "age": { "type": "integer" } + }, + "dependentRequired": { + "age": ["name"] + }, + "dependentSchemas": { + "name": { + "properties": { + "nickname": { "type": "string" } + } + } + }, + "unevaluatedProperties": false +} diff --git a/test/corpus/compile/valid/draft2020.json b/test/corpus/compile/valid/draft2020.json new file mode 100644 index 000000000..942b344f4 --- /dev/null +++ b/test/corpus/compile/valid/draft2020.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "$defs": { + "base": { + "$dynamicAnchor": "ext", + "type": "object" + } + }, + "properties": { + "items": { + "type": "array", + "prefixItems": [{ "type": "string" }], + "items": { "type": "integer" } + } + }, + "unevaluatedProperties": false +} diff --git a/test/corpus/compile/valid/draft4.json b/test/corpus/compile/valid/draft4.json new file mode 100644 index 000000000..9f8de340a --- /dev/null +++ b/test/corpus/compile/valid/draft4.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { "type": "integer" }, + "name": { "type": "string" } + }, + "required": ["id"], + "additionalProperties": false +} diff --git a/test/corpus/compile/valid/draft6.json b/test/corpus/compile/valid/draft6.json new file mode 100644 index 000000000..fc09c7834 --- /dev/null +++ b/test/corpus/compile/valid/draft6.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "properties": { + "tag": { "type": "string", "const": "v1" } + }, + "propertyNames": { "pattern": "^[a-z]" }, + "contains": { "type": "number" } +} diff --git a/test/corpus/compile/valid/draft7.json b/test/corpus/compile/valid/draft7.json new file mode 100644 index 000000000..0aac169ac --- /dev/null +++ b/test/corpus/compile/valid/draft7.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "email": { "type": "string", "format": "email" } + }, + "if": { "required": ["email"] }, + "then": { "properties": { "verified": { "type": "boolean" } } }, + "else": true +} diff --git a/test/corpus/compile/valid/not_keyword.json b/test/corpus/compile/valid/not_keyword.json new file mode 100644 index 000000000..f80a66cfa --- /dev/null +++ b/test/corpus/compile/valid/not_keyword.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "not": { + "type": "null" + } +} diff --git a/test/corpus/compile/valid/numeric_constraints.json b/test/corpus/compile/valid/numeric_constraints.json new file mode 100644 index 000000000..213109cf1 --- /dev/null +++ b/test/corpus/compile/valid/numeric_constraints.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number", + "minimum": 0, + "maximum": 100, + "exclusiveMinimum": 0, + "exclusiveMaximum": 100, + "multipleOf": 0.5 +} diff --git a/test/corpus/compile/valid/openapi_3_1.json b/test/corpus/compile/valid/openapi_3_1.json new file mode 100644 index 000000000..5d7abdca0 --- /dev/null +++ b/test/corpus/compile/valid/openapi_3_1.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", + "type": "object", + "properties": { + "name": { "type": "string" }, + "age": { "type": "integer" } + }, + "required": ["name"] +} diff --git a/test/corpus/compile/valid/openapi_3_2.json b/test/corpus/compile/valid/openapi_3_2.json new file mode 100644 index 000000000..abf3bf89e --- /dev/null +++ b/test/corpus/compile/valid/openapi_3_2.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://spec.openapis.org/oas/3.2/dialect/2025-09-17", + "type": "object", + "properties": { + "id": { "type": "integer" }, + "label": { "type": "string", "minLength": 1 } + }, + "required": ["id"] +} diff --git a/test/corpus/compile/valid/pattern_properties.json b/test/corpus/compile/valid/pattern_properties.json new file mode 100644 index 000000000..1ce0e1d69 --- /dev/null +++ b/test/corpus/compile/valid/pattern_properties.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "patternProperties": { + "^x-": { "type": "string" }, + "^[0-9]+$": { "type": "integer" } + }, + "additionalProperties": { "type": "boolean" } +} diff --git a/test/corpus/compile/valid/properties.json b/test/corpus/compile/valid/properties.json new file mode 100644 index 000000000..4a55a78e9 --- /dev/null +++ b/test/corpus/compile/valid/properties.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { "type": "string" }, + "age": { "type": "integer", "minimum": 0 } + }, + "required": ["name"] +} diff --git a/test/corpus/compile/valid/refs_and_defs.json b/test/corpus/compile/valid/refs_and_defs.json new file mode 100644 index 000000000..1d35d5381 --- /dev/null +++ b/test/corpus/compile/valid/refs_and_defs.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/address", + "$defs": { + "address": { + "type": "object", + "properties": { + "street": { "type": "string" }, + "city": { "$ref": "#/$defs/city" } + } + }, + "city": { + "type": "string", + "minLength": 1 + } + } +} diff --git a/test/corpus/compile/valid/string_constraints.json b/test/corpus/compile/valid/string_constraints.json new file mode 100644 index 000000000..7f671aea9 --- /dev/null +++ b/test/corpus/compile/valid/string_constraints.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "minLength": 1, + "maxLength": 255, + "pattern": "^[a-zA-Z0-9]+$" +} diff --git a/test/corpus/compile/valid/type_array.json b/test/corpus/compile/valid/type_array.json new file mode 100644 index 000000000..65110ce79 --- /dev/null +++ b/test/corpus/compile/valid/type_array.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": ["string", "number"] +} diff --git a/test/corpus/compile/valid/type_string.json b/test/corpus/compile/valid/type_string.json new file mode 100644 index 000000000..d423e9e6c --- /dev/null +++ b/test/corpus/compile/valid/type_string.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" +} From fa15be49b6b29adec6754d8cd6da62e2f48f0789 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:11:26 +0000 Subject: [PATCH 03/11] test: add invalid and edge-case schema inputs for robustness testing Signed-off-by: Vaibhav mittal --- test/corpus/compile/edge_cases/array_root.json | 1 + test/corpus/compile/edge_cases/boolean_false.json | 1 + test/corpus/compile/edge_cases/boolean_true.json | 1 + test/corpus/compile/edge_cases/dangling_ref.json | 4 ++++ test/corpus/compile/edge_cases/deeply_nested_allof.json | 4 ++++ test/corpus/compile/edge_cases/duplicate_keys.json | 8 ++++++++ test/corpus/compile/edge_cases/empty_enum.json | 4 ++++ test/corpus/compile/edge_cases/empty_keyword_values.json | 9 +++++++++ test/corpus/compile/edge_cases/empty_object.json | 1 + test/corpus/compile/edge_cases/empty_property_name.json | 8 ++++++++ .../compile/edge_cases/extreme_numeric_bounds.json | 6 ++++++ .../corpus/compile/edge_cases/invalid_regex_pattern.json | 4 ++++ test/corpus/compile/edge_cases/number_root.json | 1 + test/corpus/compile/edge_cases/self_referencing.json | 7 +++++++ test/corpus/compile/edge_cases/unicode_keys.json | 9 +++++++++ test/corpus/compile/edge_cases/unknown_keywords.json | 7 +++++++ test/corpus/compile/invalid_json/empty.json | 0 .../compile/invalid_json/missing_closing_brace.json | 1 + test/corpus/compile/invalid_json/missing_comma.json | 5 +++++ test/corpus/compile/invalid_json/multiple_roots.json | 1 + test/corpus/compile/invalid_json/plain_text.json | 1 + test/corpus/compile/invalid_json/trailing_comma.json | 1 + test/corpus/compile/invalid_json/truncated.json | 1 + test/corpus/compile/invalid_json/unquoted_key.json | 1 + .../invalid_schema/additional_properties_as_number.json | 5 +++++ test/corpus/compile/invalid_schema/items_as_string.json | 4 ++++ .../compile/invalid_schema/max_length_negative.json | 4 ++++ .../compile/invalid_schema/multiple_of_negative.json | 4 ++++ test/corpus/compile/invalid_schema/multiple_of_zero.json | 4 ++++ test/corpus/compile/invalid_schema/ref_as_number.json | 4 ++++ test/corpus/compile/invalid_schema/type_as_integer.json | 4 ++++ test/corpus/compile/unknown_dialect/close_but_wrong.json | 4 ++++ test/corpus/compile/unknown_dialect/empty_dialect.json | 4 ++++ test/corpus/compile/unknown_dialect/future_draft.json | 4 ++++ test/corpus/compile/unknown_dialect/unknown_url.json | 4 ++++ test/corpus/compile/unknown_dialect/urn_dialect.json | 7 +++++++ 36 files changed, 138 insertions(+) create mode 100644 test/corpus/compile/edge_cases/array_root.json create mode 100644 test/corpus/compile/edge_cases/boolean_false.json create mode 100644 test/corpus/compile/edge_cases/boolean_true.json create mode 100644 test/corpus/compile/edge_cases/dangling_ref.json create mode 100644 test/corpus/compile/edge_cases/deeply_nested_allof.json create mode 100644 test/corpus/compile/edge_cases/duplicate_keys.json create mode 100644 test/corpus/compile/edge_cases/empty_enum.json create mode 100644 test/corpus/compile/edge_cases/empty_keyword_values.json create mode 100644 test/corpus/compile/edge_cases/empty_object.json create mode 100644 test/corpus/compile/edge_cases/empty_property_name.json create mode 100644 test/corpus/compile/edge_cases/extreme_numeric_bounds.json create mode 100644 test/corpus/compile/edge_cases/invalid_regex_pattern.json create mode 100644 test/corpus/compile/edge_cases/number_root.json create mode 100644 test/corpus/compile/edge_cases/self_referencing.json create mode 100644 test/corpus/compile/edge_cases/unicode_keys.json create mode 100644 test/corpus/compile/edge_cases/unknown_keywords.json create mode 100644 test/corpus/compile/invalid_json/empty.json create mode 100644 test/corpus/compile/invalid_json/missing_closing_brace.json create mode 100644 test/corpus/compile/invalid_json/missing_comma.json create mode 100644 test/corpus/compile/invalid_json/multiple_roots.json create mode 100644 test/corpus/compile/invalid_json/plain_text.json create mode 100644 test/corpus/compile/invalid_json/trailing_comma.json create mode 100644 test/corpus/compile/invalid_json/truncated.json create mode 100644 test/corpus/compile/invalid_json/unquoted_key.json create mode 100644 test/corpus/compile/invalid_schema/additional_properties_as_number.json create mode 100644 test/corpus/compile/invalid_schema/items_as_string.json create mode 100644 test/corpus/compile/invalid_schema/max_length_negative.json create mode 100644 test/corpus/compile/invalid_schema/multiple_of_negative.json create mode 100644 test/corpus/compile/invalid_schema/multiple_of_zero.json create mode 100644 test/corpus/compile/invalid_schema/ref_as_number.json create mode 100644 test/corpus/compile/invalid_schema/type_as_integer.json create mode 100644 test/corpus/compile/unknown_dialect/close_but_wrong.json create mode 100644 test/corpus/compile/unknown_dialect/empty_dialect.json create mode 100644 test/corpus/compile/unknown_dialect/future_draft.json create mode 100644 test/corpus/compile/unknown_dialect/unknown_url.json create mode 100644 test/corpus/compile/unknown_dialect/urn_dialect.json diff --git a/test/corpus/compile/edge_cases/array_root.json b/test/corpus/compile/edge_cases/array_root.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/test/corpus/compile/edge_cases/array_root.json @@ -0,0 +1 @@ +[] diff --git a/test/corpus/compile/edge_cases/boolean_false.json b/test/corpus/compile/edge_cases/boolean_false.json new file mode 100644 index 000000000..c508d5366 --- /dev/null +++ b/test/corpus/compile/edge_cases/boolean_false.json @@ -0,0 +1 @@ +false diff --git a/test/corpus/compile/edge_cases/boolean_true.json b/test/corpus/compile/edge_cases/boolean_true.json new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/test/corpus/compile/edge_cases/boolean_true.json @@ -0,0 +1 @@ +true diff --git a/test/corpus/compile/edge_cases/dangling_ref.json b/test/corpus/compile/edge_cases/dangling_ref.json new file mode 100644 index 000000000..76e8aaf49 --- /dev/null +++ b/test/corpus/compile/edge_cases/dangling_ref.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/nonexistent" +} diff --git a/test/corpus/compile/edge_cases/deeply_nested_allof.json b/test/corpus/compile/edge_cases/deeply_nested_allof.json new file mode 100644 index 000000000..0a860fcc3 --- /dev/null +++ b/test/corpus/compile/edge_cases/deeply_nested_allof.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"type": "string"}]}]}]}]}]}]}]}]}]}] +} diff --git a/test/corpus/compile/edge_cases/duplicate_keys.json b/test/corpus/compile/edge_cases/duplicate_keys.json new file mode 100644 index 000000000..501add307 --- /dev/null +++ b/test/corpus/compile/edge_cases/duplicate_keys.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { "type": "string" }, + "name": { "type": "integer" } + } +} diff --git a/test/corpus/compile/edge_cases/empty_enum.json b/test/corpus/compile/edge_cases/empty_enum.json new file mode 100644 index 000000000..7ce3ab4e2 --- /dev/null +++ b/test/corpus/compile/edge_cases/empty_enum.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "enum": [] +} diff --git a/test/corpus/compile/edge_cases/empty_keyword_values.json b/test/corpus/compile/edge_cases/empty_keyword_values.json new file mode 100644 index 000000000..408a049e1 --- /dev/null +++ b/test/corpus/compile/edge_cases/empty_keyword_values.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": {}, + "required": [], + "allOf": [], + "anyOf": [], + "oneOf": [] +} diff --git a/test/corpus/compile/edge_cases/empty_object.json b/test/corpus/compile/edge_cases/empty_object.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/test/corpus/compile/edge_cases/empty_object.json @@ -0,0 +1 @@ +{} diff --git a/test/corpus/compile/edge_cases/empty_property_name.json b/test/corpus/compile/edge_cases/empty_property_name.json new file mode 100644 index 000000000..470493b35 --- /dev/null +++ b/test/corpus/compile/edge_cases/empty_property_name.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "": { "type": "string" } + }, + "required": [""] +} diff --git a/test/corpus/compile/edge_cases/extreme_numeric_bounds.json b/test/corpus/compile/edge_cases/extreme_numeric_bounds.json new file mode 100644 index 000000000..17c59c995 --- /dev/null +++ b/test/corpus/compile/edge_cases/extreme_numeric_bounds.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number", + "minimum": 1e308, + "maximum": 1e308 +} diff --git a/test/corpus/compile/edge_cases/invalid_regex_pattern.json b/test/corpus/compile/edge_cases/invalid_regex_pattern.json new file mode 100644 index 000000000..1d8c5f893 --- /dev/null +++ b/test/corpus/compile/edge_cases/invalid_regex_pattern.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "pattern": "[invalid(regex" +} diff --git a/test/corpus/compile/edge_cases/number_root.json b/test/corpus/compile/edge_cases/number_root.json new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/test/corpus/compile/edge_cases/number_root.json @@ -0,0 +1 @@ +42 diff --git a/test/corpus/compile/edge_cases/self_referencing.json b/test/corpus/compile/edge_cases/self_referencing.json new file mode 100644 index 000000000..215eb669b --- /dev/null +++ b/test/corpus/compile/edge_cases/self_referencing.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/self", + "$defs": { + "self": { "$ref": "#/$defs/self" } + } +} diff --git a/test/corpus/compile/edge_cases/unicode_keys.json b/test/corpus/compile/edge_cases/unicode_keys.json new file mode 100644 index 000000000..4d3dcdf3a --- /dev/null +++ b/test/corpus/compile/edge_cases/unicode_keys.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "héllo": { "type": "string" }, + "日本語": { "type": "string" }, + "🎉": { "type": "boolean" } + } +} diff --git a/test/corpus/compile/edge_cases/unknown_keywords.json b/test/corpus/compile/edge_cases/unknown_keywords.json new file mode 100644 index 000000000..11dba29b7 --- /dev/null +++ b/test/corpus/compile/edge_cases/unknown_keywords.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "unknown_keyword": true, + "x-custom-extension": { "foo": "bar" }, + "notAKeyword": [1, 2, 3] +} diff --git a/test/corpus/compile/invalid_json/empty.json b/test/corpus/compile/invalid_json/empty.json new file mode 100644 index 000000000..e69de29bb diff --git a/test/corpus/compile/invalid_json/missing_closing_brace.json b/test/corpus/compile/invalid_json/missing_closing_brace.json new file mode 100644 index 000000000..98232c64f --- /dev/null +++ b/test/corpus/compile/invalid_json/missing_closing_brace.json @@ -0,0 +1 @@ +{ diff --git a/test/corpus/compile/invalid_json/missing_comma.json b/test/corpus/compile/invalid_json/missing_comma.json new file mode 100644 index 000000000..76260bd9e --- /dev/null +++ b/test/corpus/compile/invalid_json/missing_comma.json @@ -0,0 +1,5 @@ +{ + "type": "string", + "minLength": 1 + "maxLength": 10 +} diff --git a/test/corpus/compile/invalid_json/multiple_roots.json b/test/corpus/compile/invalid_json/multiple_roots.json new file mode 100644 index 000000000..a1de8f070 --- /dev/null +++ b/test/corpus/compile/invalid_json/multiple_roots.json @@ -0,0 +1 @@ +{"type": "string"} {"type": "number"} diff --git a/test/corpus/compile/invalid_json/plain_text.json b/test/corpus/compile/invalid_json/plain_text.json new file mode 100644 index 000000000..3cc552724 --- /dev/null +++ b/test/corpus/compile/invalid_json/plain_text.json @@ -0,0 +1 @@ +hello world this is not json diff --git a/test/corpus/compile/invalid_json/trailing_comma.json b/test/corpus/compile/invalid_json/trailing_comma.json new file mode 100644 index 000000000..faa5cdf84 --- /dev/null +++ b/test/corpus/compile/invalid_json/trailing_comma.json @@ -0,0 +1 @@ +{"type": "string",} diff --git a/test/corpus/compile/invalid_json/truncated.json b/test/corpus/compile/invalid_json/truncated.json new file mode 100644 index 000000000..39d2114d9 --- /dev/null +++ b/test/corpus/compile/invalid_json/truncated.json @@ -0,0 +1 @@ +{"type": "stri \ No newline at end of file diff --git a/test/corpus/compile/invalid_json/unquoted_key.json b/test/corpus/compile/invalid_json/unquoted_key.json new file mode 100644 index 000000000..3ec45d42f --- /dev/null +++ b/test/corpus/compile/invalid_json/unquoted_key.json @@ -0,0 +1 @@ +{type: "string"} diff --git a/test/corpus/compile/invalid_schema/additional_properties_as_number.json b/test/corpus/compile/invalid_schema/additional_properties_as_number.json new file mode 100644 index 000000000..b5a6d7a9c --- /dev/null +++ b/test/corpus/compile/invalid_schema/additional_properties_as_number.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": 42 +} diff --git a/test/corpus/compile/invalid_schema/items_as_string.json b/test/corpus/compile/invalid_schema/items_as_string.json new file mode 100644 index 000000000..c3ef3a752 --- /dev/null +++ b/test/corpus/compile/invalid_schema/items_as_string.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "items": "invalid" +} diff --git a/test/corpus/compile/invalid_schema/max_length_negative.json b/test/corpus/compile/invalid_schema/max_length_negative.json new file mode 100644 index 000000000..6f9fa21d0 --- /dev/null +++ b/test/corpus/compile/invalid_schema/max_length_negative.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "maxLength": -1 +} diff --git a/test/corpus/compile/invalid_schema/multiple_of_negative.json b/test/corpus/compile/invalid_schema/multiple_of_negative.json new file mode 100644 index 000000000..8be2aaf11 --- /dev/null +++ b/test/corpus/compile/invalid_schema/multiple_of_negative.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "multipleOf": -5 +} diff --git a/test/corpus/compile/invalid_schema/multiple_of_zero.json b/test/corpus/compile/invalid_schema/multiple_of_zero.json new file mode 100644 index 000000000..8d99fc161 --- /dev/null +++ b/test/corpus/compile/invalid_schema/multiple_of_zero.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "multipleOf": 0 +} diff --git a/test/corpus/compile/invalid_schema/ref_as_number.json b/test/corpus/compile/invalid_schema/ref_as_number.json new file mode 100644 index 000000000..5a1803bca --- /dev/null +++ b/test/corpus/compile/invalid_schema/ref_as_number.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": 42 +} diff --git a/test/corpus/compile/invalid_schema/type_as_integer.json b/test/corpus/compile/invalid_schema/type_as_integer.json new file mode 100644 index 000000000..5e51d9479 --- /dev/null +++ b/test/corpus/compile/invalid_schema/type_as_integer.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": 123 +} diff --git a/test/corpus/compile/unknown_dialect/close_but_wrong.json b/test/corpus/compile/unknown_dialect/close_but_wrong.json new file mode 100644 index 000000000..7a225d9fe --- /dev/null +++ b/test/corpus/compile/unknown_dialect/close_but_wrong.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#but-wrong", + "type": "string" +} diff --git a/test/corpus/compile/unknown_dialect/empty_dialect.json b/test/corpus/compile/unknown_dialect/empty_dialect.json new file mode 100644 index 000000000..09ff5aee9 --- /dev/null +++ b/test/corpus/compile/unknown_dialect/empty_dialect.json @@ -0,0 +1,4 @@ +{ + "$schema": "", + "type": "string" +} diff --git a/test/corpus/compile/unknown_dialect/future_draft.json b/test/corpus/compile/unknown_dialect/future_draft.json new file mode 100644 index 000000000..84ea5c5e5 --- /dev/null +++ b/test/corpus/compile/unknown_dialect/future_draft.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json-schema.org/draft/2099-01/schema", + "type": "string" +} diff --git a/test/corpus/compile/unknown_dialect/unknown_url.json b/test/corpus/compile/unknown_dialect/unknown_url.json new file mode 100644 index 000000000..5e2e8cfe2 --- /dev/null +++ b/test/corpus/compile/unknown_dialect/unknown_url.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://example.com/unknown-dialect", + "type": "string" +} diff --git a/test/corpus/compile/unknown_dialect/urn_dialect.json b/test/corpus/compile/unknown_dialect/urn_dialect.json new file mode 100644 index 000000000..aebafd902 --- /dev/null +++ b/test/corpus/compile/unknown_dialect/urn_dialect.json @@ -0,0 +1,7 @@ +{ + "$schema": "urn:not:a:real:schema", + "type": "object", + "properties": { + "name": { "type": "string" } + } +} From 9230476f98c05f43780b161f513164218c7f2c82 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:12:08 +0000 Subject: [PATCH 04/11] test: add stress schemas to exercise compilation limits Signed-off-by: Vaibhav mittal --- test/corpus/compile/stress/deep_nesting.json | 154 ++++ test/corpus/compile/stress/large_enum.json | 505 +++++++++++ test/corpus/compile/stress/many_allof.json | 355 ++++++++ .../stress/many_pattern_properties.json | 156 ++++ .../compile/stress/many_properties.json | 858 ++++++++++++++++++ test/corpus/compile/stress/many_required.json | 106 +++ 6 files changed, 2134 insertions(+) create mode 100644 test/corpus/compile/stress/deep_nesting.json create mode 100644 test/corpus/compile/stress/large_enum.json create mode 100644 test/corpus/compile/stress/many_allof.json create mode 100644 test/corpus/compile/stress/many_pattern_properties.json create mode 100644 test/corpus/compile/stress/many_properties.json create mode 100644 test/corpus/compile/stress/many_required.json diff --git a/test/corpus/compile/stress/deep_nesting.json b/test/corpus/compile/stress/deep_nesting.json new file mode 100644 index 000000000..c0bbce46b --- /dev/null +++ b/test/corpus/compile/stress/deep_nesting.json @@ -0,0 +1,154 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "object", + "properties": { + "child": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/test/corpus/compile/stress/large_enum.json b/test/corpus/compile/stress/large_enum.json new file mode 100644 index 000000000..6f8ea014b --- /dev/null +++ b/test/corpus/compile/stress/large_enum.json @@ -0,0 +1,505 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "enum": [ + "value_0", + "value_1", + "value_2", + "value_3", + "value_4", + "value_5", + "value_6", + "value_7", + "value_8", + "value_9", + "value_10", + "value_11", + "value_12", + "value_13", + "value_14", + "value_15", + "value_16", + "value_17", + "value_18", + "value_19", + "value_20", + "value_21", + "value_22", + "value_23", + "value_24", + "value_25", + "value_26", + "value_27", + "value_28", + "value_29", + "value_30", + "value_31", + "value_32", + "value_33", + "value_34", + "value_35", + "value_36", + "value_37", + "value_38", + "value_39", + "value_40", + "value_41", + "value_42", + "value_43", + "value_44", + "value_45", + "value_46", + "value_47", + "value_48", + "value_49", + "value_50", + "value_51", + "value_52", + "value_53", + "value_54", + "value_55", + "value_56", + "value_57", + "value_58", + "value_59", + "value_60", + "value_61", + "value_62", + "value_63", + "value_64", + "value_65", + "value_66", + "value_67", + "value_68", + "value_69", + "value_70", + "value_71", + "value_72", + "value_73", + "value_74", + "value_75", + "value_76", + "value_77", + "value_78", + "value_79", + "value_80", + "value_81", + "value_82", + "value_83", + "value_84", + "value_85", + "value_86", + "value_87", + "value_88", + "value_89", + "value_90", + "value_91", + "value_92", + "value_93", + "value_94", + "value_95", + "value_96", + "value_97", + "value_98", + "value_99", + "value_100", + "value_101", + "value_102", + "value_103", + "value_104", + "value_105", + "value_106", + "value_107", + "value_108", + "value_109", + "value_110", + "value_111", + "value_112", + "value_113", + "value_114", + "value_115", + "value_116", + "value_117", + "value_118", + "value_119", + "value_120", + "value_121", + "value_122", + "value_123", + "value_124", + "value_125", + "value_126", + "value_127", + "value_128", + "value_129", + "value_130", + "value_131", + "value_132", + "value_133", + "value_134", + "value_135", + "value_136", + "value_137", + "value_138", + "value_139", + "value_140", + "value_141", + "value_142", + "value_143", + "value_144", + "value_145", + "value_146", + "value_147", + "value_148", + "value_149", + "value_150", + "value_151", + "value_152", + "value_153", + "value_154", + "value_155", + "value_156", + "value_157", + "value_158", + "value_159", + "value_160", + "value_161", + "value_162", + "value_163", + "value_164", + "value_165", + "value_166", + "value_167", + "value_168", + "value_169", + "value_170", + "value_171", + "value_172", + "value_173", + "value_174", + "value_175", + "value_176", + "value_177", + "value_178", + "value_179", + "value_180", + "value_181", + "value_182", + "value_183", + "value_184", + "value_185", + "value_186", + "value_187", + "value_188", + "value_189", + "value_190", + "value_191", + "value_192", + "value_193", + "value_194", + "value_195", + "value_196", + "value_197", + "value_198", + "value_199", + "value_200", + "value_201", + "value_202", + "value_203", + "value_204", + "value_205", + "value_206", + "value_207", + "value_208", + "value_209", + "value_210", + "value_211", + "value_212", + "value_213", + "value_214", + "value_215", + "value_216", + "value_217", + "value_218", + "value_219", + "value_220", + "value_221", + "value_222", + "value_223", + "value_224", + "value_225", + "value_226", + "value_227", + "value_228", + "value_229", + "value_230", + "value_231", + "value_232", + "value_233", + "value_234", + "value_235", + "value_236", + "value_237", + "value_238", + "value_239", + "value_240", + "value_241", + "value_242", + "value_243", + "value_244", + "value_245", + "value_246", + "value_247", + "value_248", + "value_249", + "value_250", + "value_251", + "value_252", + "value_253", + "value_254", + "value_255", + "value_256", + "value_257", + "value_258", + "value_259", + "value_260", + "value_261", + "value_262", + "value_263", + "value_264", + "value_265", + "value_266", + "value_267", + "value_268", + "value_269", + "value_270", + "value_271", + "value_272", + "value_273", + "value_274", + "value_275", + "value_276", + "value_277", + "value_278", + "value_279", + "value_280", + "value_281", + "value_282", + "value_283", + "value_284", + "value_285", + "value_286", + "value_287", + "value_288", + "value_289", + "value_290", + "value_291", + "value_292", + "value_293", + "value_294", + "value_295", + "value_296", + "value_297", + "value_298", + "value_299", + "value_300", + "value_301", + "value_302", + "value_303", + "value_304", + "value_305", + "value_306", + "value_307", + "value_308", + "value_309", + "value_310", + "value_311", + "value_312", + "value_313", + "value_314", + "value_315", + "value_316", + "value_317", + "value_318", + "value_319", + "value_320", + "value_321", + "value_322", + "value_323", + "value_324", + "value_325", + "value_326", + "value_327", + "value_328", + "value_329", + "value_330", + "value_331", + "value_332", + "value_333", + "value_334", + "value_335", + "value_336", + "value_337", + "value_338", + "value_339", + "value_340", + "value_341", + "value_342", + "value_343", + "value_344", + "value_345", + "value_346", + "value_347", + "value_348", + "value_349", + "value_350", + "value_351", + "value_352", + "value_353", + "value_354", + "value_355", + "value_356", + "value_357", + "value_358", + "value_359", + "value_360", + "value_361", + "value_362", + "value_363", + "value_364", + "value_365", + "value_366", + "value_367", + "value_368", + "value_369", + "value_370", + "value_371", + "value_372", + "value_373", + "value_374", + "value_375", + "value_376", + "value_377", + "value_378", + "value_379", + "value_380", + "value_381", + "value_382", + "value_383", + "value_384", + "value_385", + "value_386", + "value_387", + "value_388", + "value_389", + "value_390", + "value_391", + "value_392", + "value_393", + "value_394", + "value_395", + "value_396", + "value_397", + "value_398", + "value_399", + "value_400", + "value_401", + "value_402", + "value_403", + "value_404", + "value_405", + "value_406", + "value_407", + "value_408", + "value_409", + "value_410", + "value_411", + "value_412", + "value_413", + "value_414", + "value_415", + "value_416", + "value_417", + "value_418", + "value_419", + "value_420", + "value_421", + "value_422", + "value_423", + "value_424", + "value_425", + "value_426", + "value_427", + "value_428", + "value_429", + "value_430", + "value_431", + "value_432", + "value_433", + "value_434", + "value_435", + "value_436", + "value_437", + "value_438", + "value_439", + "value_440", + "value_441", + "value_442", + "value_443", + "value_444", + "value_445", + "value_446", + "value_447", + "value_448", + "value_449", + "value_450", + "value_451", + "value_452", + "value_453", + "value_454", + "value_455", + "value_456", + "value_457", + "value_458", + "value_459", + "value_460", + "value_461", + "value_462", + "value_463", + "value_464", + "value_465", + "value_466", + "value_467", + "value_468", + "value_469", + "value_470", + "value_471", + "value_472", + "value_473", + "value_474", + "value_475", + "value_476", + "value_477", + "value_478", + "value_479", + "value_480", + "value_481", + "value_482", + "value_483", + "value_484", + "value_485", + "value_486", + "value_487", + "value_488", + "value_489", + "value_490", + "value_491", + "value_492", + "value_493", + "value_494", + "value_495", + "value_496", + "value_497", + "value_498", + "value_499" + ] +} diff --git a/test/corpus/compile/stress/many_allof.json b/test/corpus/compile/stress/many_allof.json new file mode 100644 index 000000000..846eff7bb --- /dev/null +++ b/test/corpus/compile/stress/many_allof.json @@ -0,0 +1,355 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "allOf": [ + { + "properties": { + "prop_0": { + "type": "string" + } + } + }, + { + "properties": { + "prop_1": { + "type": "string" + } + } + }, + { + "properties": { + "prop_2": { + "type": "string" + } + } + }, + { + "properties": { + "prop_3": { + "type": "string" + } + } + }, + { + "properties": { + "prop_4": { + "type": "string" + } + } + }, + { + "properties": { + "prop_5": { + "type": "string" + } + } + }, + { + "properties": { + "prop_6": { + "type": "string" + } + } + }, + { + "properties": { + "prop_7": { + "type": "string" + } + } + }, + { + "properties": { + "prop_8": { + "type": "string" + } + } + }, + { + "properties": { + "prop_9": { + "type": "string" + } + } + }, + { + "properties": { + "prop_10": { + "type": "string" + } + } + }, + { + "properties": { + "prop_11": { + "type": "string" + } + } + }, + { + "properties": { + "prop_12": { + "type": "string" + } + } + }, + { + "properties": { + "prop_13": { + "type": "string" + } + } + }, + { + "properties": { + "prop_14": { + "type": "string" + } + } + }, + { + "properties": { + "prop_15": { + "type": "string" + } + } + }, + { + "properties": { + "prop_16": { + "type": "string" + } + } + }, + { + "properties": { + "prop_17": { + "type": "string" + } + } + }, + { + "properties": { + "prop_18": { + "type": "string" + } + } + }, + { + "properties": { + "prop_19": { + "type": "string" + } + } + }, + { + "properties": { + "prop_20": { + "type": "string" + } + } + }, + { + "properties": { + "prop_21": { + "type": "string" + } + } + }, + { + "properties": { + "prop_22": { + "type": "string" + } + } + }, + { + "properties": { + "prop_23": { + "type": "string" + } + } + }, + { + "properties": { + "prop_24": { + "type": "string" + } + } + }, + { + "properties": { + "prop_25": { + "type": "string" + } + } + }, + { + "properties": { + "prop_26": { + "type": "string" + } + } + }, + { + "properties": { + "prop_27": { + "type": "string" + } + } + }, + { + "properties": { + "prop_28": { + "type": "string" + } + } + }, + { + "properties": { + "prop_29": { + "type": "string" + } + } + }, + { + "properties": { + "prop_30": { + "type": "string" + } + } + }, + { + "properties": { + "prop_31": { + "type": "string" + } + } + }, + { + "properties": { + "prop_32": { + "type": "string" + } + } + }, + { + "properties": { + "prop_33": { + "type": "string" + } + } + }, + { + "properties": { + "prop_34": { + "type": "string" + } + } + }, + { + "properties": { + "prop_35": { + "type": "string" + } + } + }, + { + "properties": { + "prop_36": { + "type": "string" + } + } + }, + { + "properties": { + "prop_37": { + "type": "string" + } + } + }, + { + "properties": { + "prop_38": { + "type": "string" + } + } + }, + { + "properties": { + "prop_39": { + "type": "string" + } + } + }, + { + "properties": { + "prop_40": { + "type": "string" + } + } + }, + { + "properties": { + "prop_41": { + "type": "string" + } + } + }, + { + "properties": { + "prop_42": { + "type": "string" + } + } + }, + { + "properties": { + "prop_43": { + "type": "string" + } + } + }, + { + "properties": { + "prop_44": { + "type": "string" + } + } + }, + { + "properties": { + "prop_45": { + "type": "string" + } + } + }, + { + "properties": { + "prop_46": { + "type": "string" + } + } + }, + { + "properties": { + "prop_47": { + "type": "string" + } + } + }, + { + "properties": { + "prop_48": { + "type": "string" + } + } + }, + { + "properties": { + "prop_49": { + "type": "string" + } + } + } + ] +} diff --git a/test/corpus/compile/stress/many_pattern_properties.json b/test/corpus/compile/stress/many_pattern_properties.json new file mode 100644 index 000000000..27311a510 --- /dev/null +++ b/test/corpus/compile/stress/many_pattern_properties.json @@ -0,0 +1,156 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "patternProperties": { + "^prefix_0_": { + "type": "string" + }, + "^prefix_1_": { + "type": "string" + }, + "^prefix_2_": { + "type": "string" + }, + "^prefix_3_": { + "type": "string" + }, + "^prefix_4_": { + "type": "string" + }, + "^prefix_5_": { + "type": "string" + }, + "^prefix_6_": { + "type": "string" + }, + "^prefix_7_": { + "type": "string" + }, + "^prefix_8_": { + "type": "string" + }, + "^prefix_9_": { + "type": "string" + }, + "^prefix_10_": { + "type": "string" + }, + "^prefix_11_": { + "type": "string" + }, + "^prefix_12_": { + "type": "string" + }, + "^prefix_13_": { + "type": "string" + }, + "^prefix_14_": { + "type": "string" + }, + "^prefix_15_": { + "type": "string" + }, + "^prefix_16_": { + "type": "string" + }, + "^prefix_17_": { + "type": "string" + }, + "^prefix_18_": { + "type": "string" + }, + "^prefix_19_": { + "type": "string" + }, + "^prefix_20_": { + "type": "string" + }, + "^prefix_21_": { + "type": "string" + }, + "^prefix_22_": { + "type": "string" + }, + "^prefix_23_": { + "type": "string" + }, + "^prefix_24_": { + "type": "string" + }, + "^prefix_25_": { + "type": "string" + }, + "^prefix_26_": { + "type": "string" + }, + "^prefix_27_": { + "type": "string" + }, + "^prefix_28_": { + "type": "string" + }, + "^prefix_29_": { + "type": "string" + }, + "^prefix_30_": { + "type": "string" + }, + "^prefix_31_": { + "type": "string" + }, + "^prefix_32_": { + "type": "string" + }, + "^prefix_33_": { + "type": "string" + }, + "^prefix_34_": { + "type": "string" + }, + "^prefix_35_": { + "type": "string" + }, + "^prefix_36_": { + "type": "string" + }, + "^prefix_37_": { + "type": "string" + }, + "^prefix_38_": { + "type": "string" + }, + "^prefix_39_": { + "type": "string" + }, + "^prefix_40_": { + "type": "string" + }, + "^prefix_41_": { + "type": "string" + }, + "^prefix_42_": { + "type": "string" + }, + "^prefix_43_": { + "type": "string" + }, + "^prefix_44_": { + "type": "string" + }, + "^prefix_45_": { + "type": "string" + }, + "^prefix_46_": { + "type": "string" + }, + "^prefix_47_": { + "type": "string" + }, + "^prefix_48_": { + "type": "string" + }, + "^prefix_49_": { + "type": "string" + } + } +} diff --git a/test/corpus/compile/stress/many_properties.json b/test/corpus/compile/stress/many_properties.json new file mode 100644 index 000000000..eec9da920 --- /dev/null +++ b/test/corpus/compile/stress/many_properties.json @@ -0,0 +1,858 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "field_0": { + "type": "string", + "minLength": 1 + }, + "field_1": { + "type": "string", + "minLength": 1 + }, + "field_2": { + "type": "string", + "minLength": 1 + }, + "field_3": { + "type": "string", + "minLength": 1 + }, + "field_4": { + "type": "string", + "minLength": 1 + }, + "field_5": { + "type": "string", + "minLength": 1 + }, + "field_6": { + "type": "string", + "minLength": 1 + }, + "field_7": { + "type": "string", + "minLength": 1 + }, + "field_8": { + "type": "string", + "minLength": 1 + }, + "field_9": { + "type": "string", + "minLength": 1 + }, + "field_10": { + "type": "string", + "minLength": 1 + }, + "field_11": { + "type": "string", + "minLength": 1 + }, + "field_12": { + "type": "string", + "minLength": 1 + }, + "field_13": { + "type": "string", + "minLength": 1 + }, + "field_14": { + "type": "string", + "minLength": 1 + }, + "field_15": { + "type": "string", + "minLength": 1 + }, + "field_16": { + "type": "string", + "minLength": 1 + }, + "field_17": { + "type": "string", + "minLength": 1 + }, + "field_18": { + "type": "string", + "minLength": 1 + }, + "field_19": { + "type": "string", + "minLength": 1 + }, + "field_20": { + "type": "string", + "minLength": 1 + }, + "field_21": { + "type": "string", + "minLength": 1 + }, + "field_22": { + "type": "string", + "minLength": 1 + }, + "field_23": { + "type": "string", + "minLength": 1 + }, + "field_24": { + "type": "string", + "minLength": 1 + }, + "field_25": { + "type": "string", + "minLength": 1 + }, + "field_26": { + "type": "string", + "minLength": 1 + }, + "field_27": { + "type": "string", + "minLength": 1 + }, + "field_28": { + "type": "string", + "minLength": 1 + }, + "field_29": { + "type": "string", + "minLength": 1 + }, + "field_30": { + "type": "string", + "minLength": 1 + }, + "field_31": { + "type": "string", + "minLength": 1 + }, + "field_32": { + "type": "string", + "minLength": 1 + }, + "field_33": { + "type": "string", + "minLength": 1 + }, + "field_34": { + "type": "string", + "minLength": 1 + }, + "field_35": { + "type": "string", + "minLength": 1 + }, + "field_36": { + "type": "string", + "minLength": 1 + }, + "field_37": { + "type": "string", + "minLength": 1 + }, + "field_38": { + "type": "string", + "minLength": 1 + }, + "field_39": { + "type": "string", + "minLength": 1 + }, + "field_40": { + "type": "string", + "minLength": 1 + }, + "field_41": { + "type": "string", + "minLength": 1 + }, + "field_42": { + "type": "string", + "minLength": 1 + }, + "field_43": { + "type": "string", + "minLength": 1 + }, + "field_44": { + "type": "string", + "minLength": 1 + }, + "field_45": { + "type": "string", + "minLength": 1 + }, + "field_46": { + "type": "string", + "minLength": 1 + }, + "field_47": { + "type": "string", + "minLength": 1 + }, + "field_48": { + "type": "string", + "minLength": 1 + }, + "field_49": { + "type": "string", + "minLength": 1 + }, + "field_50": { + "type": "string", + "minLength": 1 + }, + "field_51": { + "type": "string", + "minLength": 1 + }, + "field_52": { + "type": "string", + "minLength": 1 + }, + "field_53": { + "type": "string", + "minLength": 1 + }, + "field_54": { + "type": "string", + "minLength": 1 + }, + "field_55": { + "type": "string", + "minLength": 1 + }, + "field_56": { + "type": "string", + "minLength": 1 + }, + "field_57": { + "type": "string", + "minLength": 1 + }, + "field_58": { + "type": "string", + "minLength": 1 + }, + "field_59": { + "type": "string", + "minLength": 1 + }, + "field_60": { + "type": "string", + "minLength": 1 + }, + "field_61": { + "type": "string", + "minLength": 1 + }, + "field_62": { + "type": "string", + "minLength": 1 + }, + "field_63": { + "type": "string", + "minLength": 1 + }, + "field_64": { + "type": "string", + "minLength": 1 + }, + "field_65": { + "type": "string", + "minLength": 1 + }, + "field_66": { + "type": "string", + "minLength": 1 + }, + "field_67": { + "type": "string", + "minLength": 1 + }, + "field_68": { + "type": "string", + "minLength": 1 + }, + "field_69": { + "type": "string", + "minLength": 1 + }, + "field_70": { + "type": "string", + "minLength": 1 + }, + "field_71": { + "type": "string", + "minLength": 1 + }, + "field_72": { + "type": "string", + "minLength": 1 + }, + "field_73": { + "type": "string", + "minLength": 1 + }, + "field_74": { + "type": "string", + "minLength": 1 + }, + "field_75": { + "type": "string", + "minLength": 1 + }, + "field_76": { + "type": "string", + "minLength": 1 + }, + "field_77": { + "type": "string", + "minLength": 1 + }, + "field_78": { + "type": "string", + "minLength": 1 + }, + "field_79": { + "type": "string", + "minLength": 1 + }, + "field_80": { + "type": "string", + "minLength": 1 + }, + "field_81": { + "type": "string", + "minLength": 1 + }, + "field_82": { + "type": "string", + "minLength": 1 + }, + "field_83": { + "type": "string", + "minLength": 1 + }, + "field_84": { + "type": "string", + "minLength": 1 + }, + "field_85": { + "type": "string", + "minLength": 1 + }, + "field_86": { + "type": "string", + "minLength": 1 + }, + "field_87": { + "type": "string", + "minLength": 1 + }, + "field_88": { + "type": "string", + "minLength": 1 + }, + "field_89": { + "type": "string", + "minLength": 1 + }, + "field_90": { + "type": "string", + "minLength": 1 + }, + "field_91": { + "type": "string", + "minLength": 1 + }, + "field_92": { + "type": "string", + "minLength": 1 + }, + "field_93": { + "type": "string", + "minLength": 1 + }, + "field_94": { + "type": "string", + "minLength": 1 + }, + "field_95": { + "type": "string", + "minLength": 1 + }, + "field_96": { + "type": "string", + "minLength": 1 + }, + "field_97": { + "type": "string", + "minLength": 1 + }, + "field_98": { + "type": "string", + "minLength": 1 + }, + "field_99": { + "type": "string", + "minLength": 1 + }, + "field_100": { + "type": "string", + "minLength": 1 + }, + "field_101": { + "type": "string", + "minLength": 1 + }, + "field_102": { + "type": "string", + "minLength": 1 + }, + "field_103": { + "type": "string", + "minLength": 1 + }, + "field_104": { + "type": "string", + "minLength": 1 + }, + "field_105": { + "type": "string", + "minLength": 1 + }, + "field_106": { + "type": "string", + "minLength": 1 + }, + "field_107": { + "type": "string", + "minLength": 1 + }, + "field_108": { + "type": "string", + "minLength": 1 + }, + "field_109": { + "type": "string", + "minLength": 1 + }, + "field_110": { + "type": "string", + "minLength": 1 + }, + "field_111": { + "type": "string", + "minLength": 1 + }, + "field_112": { + "type": "string", + "minLength": 1 + }, + "field_113": { + "type": "string", + "minLength": 1 + }, + "field_114": { + "type": "string", + "minLength": 1 + }, + "field_115": { + "type": "string", + "minLength": 1 + }, + "field_116": { + "type": "string", + "minLength": 1 + }, + "field_117": { + "type": "string", + "minLength": 1 + }, + "field_118": { + "type": "string", + "minLength": 1 + }, + "field_119": { + "type": "string", + "minLength": 1 + }, + "field_120": { + "type": "string", + "minLength": 1 + }, + "field_121": { + "type": "string", + "minLength": 1 + }, + "field_122": { + "type": "string", + "minLength": 1 + }, + "field_123": { + "type": "string", + "minLength": 1 + }, + "field_124": { + "type": "string", + "minLength": 1 + }, + "field_125": { + "type": "string", + "minLength": 1 + }, + "field_126": { + "type": "string", + "minLength": 1 + }, + "field_127": { + "type": "string", + "minLength": 1 + }, + "field_128": { + "type": "string", + "minLength": 1 + }, + "field_129": { + "type": "string", + "minLength": 1 + }, + "field_130": { + "type": "string", + "minLength": 1 + }, + "field_131": { + "type": "string", + "minLength": 1 + }, + "field_132": { + "type": "string", + "minLength": 1 + }, + "field_133": { + "type": "string", + "minLength": 1 + }, + "field_134": { + "type": "string", + "minLength": 1 + }, + "field_135": { + "type": "string", + "minLength": 1 + }, + "field_136": { + "type": "string", + "minLength": 1 + }, + "field_137": { + "type": "string", + "minLength": 1 + }, + "field_138": { + "type": "string", + "minLength": 1 + }, + "field_139": { + "type": "string", + "minLength": 1 + }, + "field_140": { + "type": "string", + "minLength": 1 + }, + "field_141": { + "type": "string", + "minLength": 1 + }, + "field_142": { + "type": "string", + "minLength": 1 + }, + "field_143": { + "type": "string", + "minLength": 1 + }, + "field_144": { + "type": "string", + "minLength": 1 + }, + "field_145": { + "type": "string", + "minLength": 1 + }, + "field_146": { + "type": "string", + "minLength": 1 + }, + "field_147": { + "type": "string", + "minLength": 1 + }, + "field_148": { + "type": "string", + "minLength": 1 + }, + "field_149": { + "type": "string", + "minLength": 1 + }, + "field_150": { + "type": "string", + "minLength": 1 + }, + "field_151": { + "type": "string", + "minLength": 1 + }, + "field_152": { + "type": "string", + "minLength": 1 + }, + "field_153": { + "type": "string", + "minLength": 1 + }, + "field_154": { + "type": "string", + "minLength": 1 + }, + "field_155": { + "type": "string", + "minLength": 1 + }, + "field_156": { + "type": "string", + "minLength": 1 + }, + "field_157": { + "type": "string", + "minLength": 1 + }, + "field_158": { + "type": "string", + "minLength": 1 + }, + "field_159": { + "type": "string", + "minLength": 1 + }, + "field_160": { + "type": "string", + "minLength": 1 + }, + "field_161": { + "type": "string", + "minLength": 1 + }, + "field_162": { + "type": "string", + "minLength": 1 + }, + "field_163": { + "type": "string", + "minLength": 1 + }, + "field_164": { + "type": "string", + "minLength": 1 + }, + "field_165": { + "type": "string", + "minLength": 1 + }, + "field_166": { + "type": "string", + "minLength": 1 + }, + "field_167": { + "type": "string", + "minLength": 1 + }, + "field_168": { + "type": "string", + "minLength": 1 + }, + "field_169": { + "type": "string", + "minLength": 1 + }, + "field_170": { + "type": "string", + "minLength": 1 + }, + "field_171": { + "type": "string", + "minLength": 1 + }, + "field_172": { + "type": "string", + "minLength": 1 + }, + "field_173": { + "type": "string", + "minLength": 1 + }, + "field_174": { + "type": "string", + "minLength": 1 + }, + "field_175": { + "type": "string", + "minLength": 1 + }, + "field_176": { + "type": "string", + "minLength": 1 + }, + "field_177": { + "type": "string", + "minLength": 1 + }, + "field_178": { + "type": "string", + "minLength": 1 + }, + "field_179": { + "type": "string", + "minLength": 1 + }, + "field_180": { + "type": "string", + "minLength": 1 + }, + "field_181": { + "type": "string", + "minLength": 1 + }, + "field_182": { + "type": "string", + "minLength": 1 + }, + "field_183": { + "type": "string", + "minLength": 1 + }, + "field_184": { + "type": "string", + "minLength": 1 + }, + "field_185": { + "type": "string", + "minLength": 1 + }, + "field_186": { + "type": "string", + "minLength": 1 + }, + "field_187": { + "type": "string", + "minLength": 1 + }, + "field_188": { + "type": "string", + "minLength": 1 + }, + "field_189": { + "type": "string", + "minLength": 1 + }, + "field_190": { + "type": "string", + "minLength": 1 + }, + "field_191": { + "type": "string", + "minLength": 1 + }, + "field_192": { + "type": "string", + "minLength": 1 + }, + "field_193": { + "type": "string", + "minLength": 1 + }, + "field_194": { + "type": "string", + "minLength": 1 + }, + "field_195": { + "type": "string", + "minLength": 1 + }, + "field_196": { + "type": "string", + "minLength": 1 + }, + "field_197": { + "type": "string", + "minLength": 1 + }, + "field_198": { + "type": "string", + "minLength": 1 + }, + "field_199": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "field_0", + "field_1", + "field_2", + "field_3", + "field_4", + "field_5", + "field_6", + "field_7", + "field_8", + "field_9", + "field_10", + "field_11", + "field_12", + "field_13", + "field_14", + "field_15", + "field_16", + "field_17", + "field_18", + "field_19", + "field_20", + "field_21", + "field_22", + "field_23", + "field_24", + "field_25", + "field_26", + "field_27", + "field_28", + "field_29", + "field_30", + "field_31", + "field_32", + "field_33", + "field_34", + "field_35", + "field_36", + "field_37", + "field_38", + "field_39", + "field_40", + "field_41", + "field_42", + "field_43", + "field_44", + "field_45", + "field_46", + "field_47", + "field_48", + "field_49" + ] +} diff --git a/test/corpus/compile/stress/many_required.json b/test/corpus/compile/stress/many_required.json new file mode 100644 index 000000000..81ea1c2d9 --- /dev/null +++ b/test/corpus/compile/stress/many_required.json @@ -0,0 +1,106 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "required_field_0", + "required_field_1", + "required_field_2", + "required_field_3", + "required_field_4", + "required_field_5", + "required_field_6", + "required_field_7", + "required_field_8", + "required_field_9", + "required_field_10", + "required_field_11", + "required_field_12", + "required_field_13", + "required_field_14", + "required_field_15", + "required_field_16", + "required_field_17", + "required_field_18", + "required_field_19", + "required_field_20", + "required_field_21", + "required_field_22", + "required_field_23", + "required_field_24", + "required_field_25", + "required_field_26", + "required_field_27", + "required_field_28", + "required_field_29", + "required_field_30", + "required_field_31", + "required_field_32", + "required_field_33", + "required_field_34", + "required_field_35", + "required_field_36", + "required_field_37", + "required_field_38", + "required_field_39", + "required_field_40", + "required_field_41", + "required_field_42", + "required_field_43", + "required_field_44", + "required_field_45", + "required_field_46", + "required_field_47", + "required_field_48", + "required_field_49", + "required_field_50", + "required_field_51", + "required_field_52", + "required_field_53", + "required_field_54", + "required_field_55", + "required_field_56", + "required_field_57", + "required_field_58", + "required_field_59", + "required_field_60", + "required_field_61", + "required_field_62", + "required_field_63", + "required_field_64", + "required_field_65", + "required_field_66", + "required_field_67", + "required_field_68", + "required_field_69", + "required_field_70", + "required_field_71", + "required_field_72", + "required_field_73", + "required_field_74", + "required_field_75", + "required_field_76", + "required_field_77", + "required_field_78", + "required_field_79", + "required_field_80", + "required_field_81", + "required_field_82", + "required_field_83", + "required_field_84", + "required_field_85", + "required_field_86", + "required_field_87", + "required_field_88", + "required_field_89", + "required_field_90", + "required_field_91", + "required_field_92", + "required_field_93", + "required_field_94", + "required_field_95", + "required_field_96", + "required_field_97", + "required_field_98", + "required_field_99" + ] +} From 783942786a275fbc2f6a1efddf210d60281df696 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:12:45 +0000 Subject: [PATCH 05/11] contrib: add helper script to run compile corpus locally Signed-off-by: Vaibhav mittal --- contrib/run_corpus.sh | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 contrib/run_corpus.sh diff --git a/contrib/run_corpus.sh b/contrib/run_corpus.sh new file mode 100755 index 000000000..50952825a --- /dev/null +++ b/contrib/run_corpus.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# Helper script to run the compile binary against the corpus files. +# Usage: ./contrib/run_corpus.sh +# +# This is an optional utility for local testing and fuzzing preparation. +# It is NOT part of the CI test suite. +# +# Expected behavior: +# - valid/ and stress/ files: should succeed (exit 0) +# - All other categories: should fail gracefully (exit non-zero), never crash + +set -e + +COMPILE="${1:?Usage: $0 }" +CORPUS_DIR="$(cd "$(dirname "$0")/../test/corpus/compile" && pwd)" + +if [ ! -x "$COMPILE" ]; then + echo "error: compile binary not found or not executable: $COMPILE" >&2 + exit 1 +fi + +pass=0 +fail=0 +crash=0 + +for category in valid invalid_json invalid_schema unknown_dialect edge_cases stress; do + dir="$CORPUS_DIR/$category" + [ -d "$dir" ] || continue + for f in "$dir"/*.json; do + [ -f "$f" ] || continue + name="${category}/$(basename "$f")" + + rc=0 + "$COMPILE" "$f" > /dev/null 2>&1 || rc=$? + + if [ $rc -ge 128 ]; then + echo "CRASH $name (signal $((rc - 128)))" + crash=$((crash + 1)) + elif [ "$category" = "valid" ] || [ "$category" = "stress" ]; then + if [ $rc -eq 0 ]; then + echo "PASS $name" + pass=$((pass + 1)) + else + echo "FAIL $name (expected success, got exit $rc)" + fail=$((fail + 1)) + fi + else + if [ $rc -ne 0 ]; then + echo "PASS $name (graceful error, exit $rc)" + pass=$((pass + 1)) + else + echo "NOTE $name (unexpected success, exit 0)" + pass=$((pass + 1)) + fi + fi + done +done + +echo "" +echo "Results: $pass passed, $fail failed, $crash crashed" + +if [ $crash -gt 0 ]; then + echo "ERROR: $crash files caused a crash!" >&2 + exit 1 +fi + +exit 0 From fbbf8d788efa3b1d5a6a4f9aac099dcbffa245ca Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:13:05 +0000 Subject: [PATCH 06/11] docs: document compile corpus structure and known compiler issues Signed-off-by: Vaibhav mittal --- test/corpus/compile/README.md | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/corpus/compile/README.md diff --git a/test/corpus/compile/README.md b/test/corpus/compile/README.md new file mode 100644 index 000000000..238051f71 --- /dev/null +++ b/test/corpus/compile/README.md @@ -0,0 +1,56 @@ +# Compile Corpus + +Seed corpus for fuzzing the `contrib/compile` binary with +[AFL++](https://aflplus.plus/) or similar tools. Each file is a small, +purposeful input that exercises a specific compiler path. + +This corpus is designed for fuzzing and robustness testing, not as a +formal conformance test suite. + +## Categories + +| Directory | Purpose | +|--------------------|--------------------------------------------------| +| `valid/` | Correct schemas across supported dialects | +| `invalid_json/` | Malformed JSON rejected by the parser | +| `invalid_schema/` | Valid JSON that violates JSON Schema constraints | +| `unknown_dialect/` | Schemas with unsupported `$schema` values | +| `edge_cases/` | Unusual but possibly valid inputs and boundaries | +| `stress/` | Large schemas to test performance and scale | + +## Known Issues (Discovered via Corpus) + +The following inputs trigger assertion failures (SIGABRT) inside the +compiler. They are kept in the corpus intentionally to document the +crashes and to serve as regression inputs once fixed. + +| File | Input | Issue | +|------|-------|-------| +| `invalid_schema/additional_properties_as_number.json` | `"additionalProperties": 42` | Asserts on non-boolean/non-schema value | +| `invalid_schema/items_as_string.json` | `"items": "invalid"` | Asserts on non-schema items value | +| `invalid_schema/max_length_negative.json` | `"maxLength": -1` | Asserts on negative string constraint | +| `invalid_schema/multiple_of_negative.json` | `"multipleOf": -5` | Asserts on negative multipleOf | +| `edge_cases/empty_keyword_values.json` | `"allOf": [], "anyOf": []` | Asserts on empty applicator arrays | + +Expected: graceful error (exception + exit 1). Actual: `assert()` failure. + +## Fuzzing with AFL++ + +```sh +afl-fuzz -i test/corpus/compile/ -o findings/ -- \ + ./build/contrib/sourcemeta_blaze_contrib_compile @@ +``` + +## Helper Script + +An optional helper script is available at `contrib/run_corpus.sh` to run +the full corpus locally and detect crashes: + +```sh +./contrib/run_corpus.sh ./build/contrib/sourcemeta_blaze_contrib_compile +``` + +## Adding New Files + +Each file should be **small** and have a **single clear purpose**. Name files +descriptively (e.g., `type_as_integer.json`, `deeply_nested_allof.json`). From 78cce2ebfcd95261744e8f8cea56f5cd67b4d844 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Wed, 8 Apr 2026 14:36:05 +0000 Subject: [PATCH 07/11] fix(contrib): restore expected compile CLI behavior for JS bindings and CI The is_schema() guard was checking the root document before --path extraction. When the JS test suite passes test-suite JSON files (arrays at root) with --path to navigate to the actual schema, the guard incorrectly rejected the input. Move the guard to only apply to direct (non-path) invocations, and keep the post-extraction guard for --path usage. Signed-off-by: Vaibhav mittal --- contrib/compile.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/contrib/compile.cc b/contrib/compile.cc index 82699d8a9..5bd3ec92f 100644 --- a/contrib/compile.cc +++ b/contrib/compile.cc @@ -132,14 +132,6 @@ auto main(int argc, char **argv) noexcept -> int { sourcemeta::core::read_json(std::filesystem::path{positional.front()})}; std::cerr << "Input: " << positional.front() << "\n"; - // The compiler assumes valid schema input (object or boolean) and - // asserts otherwise. Guard here at the CLI boundary to ensure - // graceful failure instead of aborting on malformed inputs. - if (!sourcemeta::core::is_schema(document)) { - std::cerr << "error: the input is not a valid JSON Schema\n"; - return EXIT_FAILURE; - } - if (options.contains("path")) { const auto pointer{sourcemeta::core::to_pointer( std::string{options.at("path").front()})}; @@ -158,6 +150,12 @@ auto main(int argc, char **argv) noexcept -> int { "JSON Schema\n"; return EXIT_FAILURE; } + } else if (!sourcemeta::core::is_schema(document)) { + // The compiler assumes valid schema input (object or boolean) and + // asserts otherwise. Guard here at the CLI boundary to ensure + // graceful failure instead of aborting on malformed inputs. + std::cerr << "error: the input is not a valid JSON Schema\n"; + return EXIT_FAILURE; } const auto compile_start{std::chrono::high_resolution_clock::now()}; From bd166cf1506a3d8060cb551875de129197e9e2e6 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Fri, 10 Apr 2026 15:02:35 +0000 Subject: [PATCH 08/11] test: add failing tests for compiler crashes discovered via compile corpus Signed-off-by: Vaibhav mittal --- test/evaluator/evaluator_test.cc | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/evaluator/evaluator_test.cc b/test/evaluator/evaluator_test.cc index 3f5c866eb..d256ab45c 100644 --- a/test/evaluator/evaluator_test.cc +++ b/test/evaluator/evaluator_test.cc @@ -314,3 +314,51 @@ TEST(Evaluator, format_assertion_vocabulary_unsupported) { FAIL() << "The compile function was expected to throw a vocabulary error"; } } + +TEST(Evaluator, invalid_additional_properties_type_crash) { + const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": 42 + })JSON")}; + + try { + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler); + FAIL() << "The compile function was expected to throw"; + } catch (const std::exception &) { + SUCCEED(); + } +} + +TEST(Evaluator, invalid_items_type_crash) { + const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "items": "invalid" + })JSON")}; + + try { + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler); + FAIL() << "The compile function was expected to throw"; + } catch (const std::exception &) { + SUCCEED(); + } +} + +TEST(Evaluator, number_root_crash) { + const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON( + 1 + )JSON")}; + + try { + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler); + FAIL() << "The compile function was expected to throw"; + } catch (const std::exception &) { + SUCCEED(); + } +} From 8ffd6e4295c6254a9de0a6d5f9cc128556ad2ef4 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Sat, 11 Apr 2026 01:59:20 +0000 Subject: [PATCH 09/11] test: narrow compile crash PR scope Signed-off-by: Vaibhav mittal --- contrib/compile.cc | 16 +- contrib/run_corpus.sh | 67 -- test/corpus/compile/README.md | 56 -- .../corpus/compile/edge_cases/array_root.json | 1 - .../compile/edge_cases/boolean_false.json | 1 - .../compile/edge_cases/boolean_true.json | 1 - .../compile/edge_cases/dangling_ref.json | 4 - .../edge_cases/deeply_nested_allof.json | 4 - .../compile/edge_cases/duplicate_keys.json | 8 - .../corpus/compile/edge_cases/empty_enum.json | 4 - .../edge_cases/empty_keyword_values.json | 9 - .../compile/edge_cases/empty_object.json | 1 - .../edge_cases/empty_property_name.json | 8 - .../edge_cases/extreme_numeric_bounds.json | 6 - .../edge_cases/invalid_regex_pattern.json | 4 - .../compile/edge_cases/number_root.json | 1 - .../compile/edge_cases/self_referencing.json | 7 - .../compile/edge_cases/unicode_keys.json | 9 - .../compile/edge_cases/unknown_keywords.json | 7 - test/corpus/compile/invalid_json/empty.json | 0 .../invalid_json/missing_closing_brace.json | 1 - .../compile/invalid_json/missing_comma.json | 5 - .../compile/invalid_json/multiple_roots.json | 1 - .../compile/invalid_json/plain_text.json | 1 - .../compile/invalid_json/trailing_comma.json | 1 - .../compile/invalid_json/truncated.json | 1 - .../compile/invalid_json/unquoted_key.json | 1 - .../additional_properties_as_number.json | 5 - .../invalid_schema/items_as_string.json | 4 - .../invalid_schema/max_length_negative.json | 4 - .../invalid_schema/multiple_of_negative.json | 4 - .../invalid_schema/multiple_of_zero.json | 4 - .../compile/invalid_schema/ref_as_number.json | 4 - .../invalid_schema/type_as_integer.json | 4 - test/corpus/compile/stress/deep_nesting.json | 154 ---- test/corpus/compile/stress/large_enum.json | 505 ----------- test/corpus/compile/stress/many_allof.json | 355 -------- .../stress/many_pattern_properties.json | 156 ---- .../compile/stress/many_properties.json | 858 ------------------ test/corpus/compile/stress/many_required.json | 106 --- .../unknown_dialect/close_but_wrong.json | 4 - .../unknown_dialect/empty_dialect.json | 4 - .../compile/unknown_dialect/future_draft.json | 4 - .../compile/unknown_dialect/unknown_url.json | 4 - .../compile/unknown_dialect/urn_dialect.json | 7 - .../compile/valid/array_constraints.json | 13 - test/corpus/compile/valid/combinators.json | 18 - test/corpus/compile/valid/complex_object.json | 30 - test/corpus/compile/valid/conditional.json | 13 - test/corpus/compile/valid/draft2019.json | 19 - test/corpus/compile/valid/draft2020.json | 18 - test/corpus/compile/valid/draft4.json | 10 - test/corpus/compile/valid/draft6.json | 9 - test/corpus/compile/valid/draft7.json | 10 - test/corpus/compile/valid/not_keyword.json | 6 - .../compile/valid/numeric_constraints.json | 9 - test/corpus/compile/valid/openapi_3_1.json | 9 - test/corpus/compile/valid/openapi_3_2.json | 9 - .../compile/valid/pattern_properties.json | 9 - test/corpus/compile/valid/properties.json | 9 - test/corpus/compile/valid/refs_and_defs.json | 17 - .../compile/valid/string_constraints.json | 7 - test/corpus/compile/valid/type_array.json | 4 - test/corpus/compile/valid/type_string.json | 4 - test/evaluator/evaluator_test.cc | 12 +- 65 files changed, 15 insertions(+), 2631 deletions(-) delete mode 100755 contrib/run_corpus.sh delete mode 100644 test/corpus/compile/README.md delete mode 100644 test/corpus/compile/edge_cases/array_root.json delete mode 100644 test/corpus/compile/edge_cases/boolean_false.json delete mode 100644 test/corpus/compile/edge_cases/boolean_true.json delete mode 100644 test/corpus/compile/edge_cases/dangling_ref.json delete mode 100644 test/corpus/compile/edge_cases/deeply_nested_allof.json delete mode 100644 test/corpus/compile/edge_cases/duplicate_keys.json delete mode 100644 test/corpus/compile/edge_cases/empty_enum.json delete mode 100644 test/corpus/compile/edge_cases/empty_keyword_values.json delete mode 100644 test/corpus/compile/edge_cases/empty_object.json delete mode 100644 test/corpus/compile/edge_cases/empty_property_name.json delete mode 100644 test/corpus/compile/edge_cases/extreme_numeric_bounds.json delete mode 100644 test/corpus/compile/edge_cases/invalid_regex_pattern.json delete mode 100644 test/corpus/compile/edge_cases/number_root.json delete mode 100644 test/corpus/compile/edge_cases/self_referencing.json delete mode 100644 test/corpus/compile/edge_cases/unicode_keys.json delete mode 100644 test/corpus/compile/edge_cases/unknown_keywords.json delete mode 100644 test/corpus/compile/invalid_json/empty.json delete mode 100644 test/corpus/compile/invalid_json/missing_closing_brace.json delete mode 100644 test/corpus/compile/invalid_json/missing_comma.json delete mode 100644 test/corpus/compile/invalid_json/multiple_roots.json delete mode 100644 test/corpus/compile/invalid_json/plain_text.json delete mode 100644 test/corpus/compile/invalid_json/trailing_comma.json delete mode 100644 test/corpus/compile/invalid_json/truncated.json delete mode 100644 test/corpus/compile/invalid_json/unquoted_key.json delete mode 100644 test/corpus/compile/invalid_schema/additional_properties_as_number.json delete mode 100644 test/corpus/compile/invalid_schema/items_as_string.json delete mode 100644 test/corpus/compile/invalid_schema/max_length_negative.json delete mode 100644 test/corpus/compile/invalid_schema/multiple_of_negative.json delete mode 100644 test/corpus/compile/invalid_schema/multiple_of_zero.json delete mode 100644 test/corpus/compile/invalid_schema/ref_as_number.json delete mode 100644 test/corpus/compile/invalid_schema/type_as_integer.json delete mode 100644 test/corpus/compile/stress/deep_nesting.json delete mode 100644 test/corpus/compile/stress/large_enum.json delete mode 100644 test/corpus/compile/stress/many_allof.json delete mode 100644 test/corpus/compile/stress/many_pattern_properties.json delete mode 100644 test/corpus/compile/stress/many_properties.json delete mode 100644 test/corpus/compile/stress/many_required.json delete mode 100644 test/corpus/compile/unknown_dialect/close_but_wrong.json delete mode 100644 test/corpus/compile/unknown_dialect/empty_dialect.json delete mode 100644 test/corpus/compile/unknown_dialect/future_draft.json delete mode 100644 test/corpus/compile/unknown_dialect/unknown_url.json delete mode 100644 test/corpus/compile/unknown_dialect/urn_dialect.json delete mode 100644 test/corpus/compile/valid/array_constraints.json delete mode 100644 test/corpus/compile/valid/combinators.json delete mode 100644 test/corpus/compile/valid/complex_object.json delete mode 100644 test/corpus/compile/valid/conditional.json delete mode 100644 test/corpus/compile/valid/draft2019.json delete mode 100644 test/corpus/compile/valid/draft2020.json delete mode 100644 test/corpus/compile/valid/draft4.json delete mode 100644 test/corpus/compile/valid/draft6.json delete mode 100644 test/corpus/compile/valid/draft7.json delete mode 100644 test/corpus/compile/valid/not_keyword.json delete mode 100644 test/corpus/compile/valid/numeric_constraints.json delete mode 100644 test/corpus/compile/valid/openapi_3_1.json delete mode 100644 test/corpus/compile/valid/openapi_3_2.json delete mode 100644 test/corpus/compile/valid/pattern_properties.json delete mode 100644 test/corpus/compile/valid/properties.json delete mode 100644 test/corpus/compile/valid/refs_and_defs.json delete mode 100644 test/corpus/compile/valid/string_constraints.json delete mode 100644 test/corpus/compile/valid/type_array.json delete mode 100644 test/corpus/compile/valid/type_string.json diff --git a/contrib/compile.cc b/contrib/compile.cc index 5bd3ec92f..dba723288 100644 --- a/contrib/compile.cc +++ b/contrib/compile.cc @@ -144,17 +144,19 @@ auto main(int argc, char **argv) noexcept -> int { auto extracted{*result}; document = std::move(extracted); + } - if (!sourcemeta::core::is_schema(document)) { + // The compiler assumes valid schema input (object or boolean) and + // asserts otherwise. Guard here at the CLI boundary to ensure + // graceful failure instead of aborting on malformed inputs. + if (!sourcemeta::core::is_schema(document)) { + if (options.contains("path")) { std::cerr << "error: the value at the given path is not a valid " "JSON Schema\n"; - return EXIT_FAILURE; + } else { + std::cerr << "error: the input is not a valid JSON Schema\n"; } - } else if (!sourcemeta::core::is_schema(document)) { - // The compiler assumes valid schema input (object or boolean) and - // asserts otherwise. Guard here at the CLI boundary to ensure - // graceful failure instead of aborting on malformed inputs. - std::cerr << "error: the input is not a valid JSON Schema\n"; + return EXIT_FAILURE; } diff --git a/contrib/run_corpus.sh b/contrib/run_corpus.sh deleted file mode 100755 index 50952825a..000000000 --- a/contrib/run_corpus.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# Helper script to run the compile binary against the corpus files. -# Usage: ./contrib/run_corpus.sh -# -# This is an optional utility for local testing and fuzzing preparation. -# It is NOT part of the CI test suite. -# -# Expected behavior: -# - valid/ and stress/ files: should succeed (exit 0) -# - All other categories: should fail gracefully (exit non-zero), never crash - -set -e - -COMPILE="${1:?Usage: $0 }" -CORPUS_DIR="$(cd "$(dirname "$0")/../test/corpus/compile" && pwd)" - -if [ ! -x "$COMPILE" ]; then - echo "error: compile binary not found or not executable: $COMPILE" >&2 - exit 1 -fi - -pass=0 -fail=0 -crash=0 - -for category in valid invalid_json invalid_schema unknown_dialect edge_cases stress; do - dir="$CORPUS_DIR/$category" - [ -d "$dir" ] || continue - for f in "$dir"/*.json; do - [ -f "$f" ] || continue - name="${category}/$(basename "$f")" - - rc=0 - "$COMPILE" "$f" > /dev/null 2>&1 || rc=$? - - if [ $rc -ge 128 ]; then - echo "CRASH $name (signal $((rc - 128)))" - crash=$((crash + 1)) - elif [ "$category" = "valid" ] || [ "$category" = "stress" ]; then - if [ $rc -eq 0 ]; then - echo "PASS $name" - pass=$((pass + 1)) - else - echo "FAIL $name (expected success, got exit $rc)" - fail=$((fail + 1)) - fi - else - if [ $rc -ne 0 ]; then - echo "PASS $name (graceful error, exit $rc)" - pass=$((pass + 1)) - else - echo "NOTE $name (unexpected success, exit 0)" - pass=$((pass + 1)) - fi - fi - done -done - -echo "" -echo "Results: $pass passed, $fail failed, $crash crashed" - -if [ $crash -gt 0 ]; then - echo "ERROR: $crash files caused a crash!" >&2 - exit 1 -fi - -exit 0 diff --git a/test/corpus/compile/README.md b/test/corpus/compile/README.md deleted file mode 100644 index 238051f71..000000000 --- a/test/corpus/compile/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Compile Corpus - -Seed corpus for fuzzing the `contrib/compile` binary with -[AFL++](https://aflplus.plus/) or similar tools. Each file is a small, -purposeful input that exercises a specific compiler path. - -This corpus is designed for fuzzing and robustness testing, not as a -formal conformance test suite. - -## Categories - -| Directory | Purpose | -|--------------------|--------------------------------------------------| -| `valid/` | Correct schemas across supported dialects | -| `invalid_json/` | Malformed JSON rejected by the parser | -| `invalid_schema/` | Valid JSON that violates JSON Schema constraints | -| `unknown_dialect/` | Schemas with unsupported `$schema` values | -| `edge_cases/` | Unusual but possibly valid inputs and boundaries | -| `stress/` | Large schemas to test performance and scale | - -## Known Issues (Discovered via Corpus) - -The following inputs trigger assertion failures (SIGABRT) inside the -compiler. They are kept in the corpus intentionally to document the -crashes and to serve as regression inputs once fixed. - -| File | Input | Issue | -|------|-------|-------| -| `invalid_schema/additional_properties_as_number.json` | `"additionalProperties": 42` | Asserts on non-boolean/non-schema value | -| `invalid_schema/items_as_string.json` | `"items": "invalid"` | Asserts on non-schema items value | -| `invalid_schema/max_length_negative.json` | `"maxLength": -1` | Asserts on negative string constraint | -| `invalid_schema/multiple_of_negative.json` | `"multipleOf": -5` | Asserts on negative multipleOf | -| `edge_cases/empty_keyword_values.json` | `"allOf": [], "anyOf": []` | Asserts on empty applicator arrays | - -Expected: graceful error (exception + exit 1). Actual: `assert()` failure. - -## Fuzzing with AFL++ - -```sh -afl-fuzz -i test/corpus/compile/ -o findings/ -- \ - ./build/contrib/sourcemeta_blaze_contrib_compile @@ -``` - -## Helper Script - -An optional helper script is available at `contrib/run_corpus.sh` to run -the full corpus locally and detect crashes: - -```sh -./contrib/run_corpus.sh ./build/contrib/sourcemeta_blaze_contrib_compile -``` - -## Adding New Files - -Each file should be **small** and have a **single clear purpose**. Name files -descriptively (e.g., `type_as_integer.json`, `deeply_nested_allof.json`). diff --git a/test/corpus/compile/edge_cases/array_root.json b/test/corpus/compile/edge_cases/array_root.json deleted file mode 100644 index fe51488c7..000000000 --- a/test/corpus/compile/edge_cases/array_root.json +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/test/corpus/compile/edge_cases/boolean_false.json b/test/corpus/compile/edge_cases/boolean_false.json deleted file mode 100644 index c508d5366..000000000 --- a/test/corpus/compile/edge_cases/boolean_false.json +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/test/corpus/compile/edge_cases/boolean_true.json b/test/corpus/compile/edge_cases/boolean_true.json deleted file mode 100644 index 27ba77dda..000000000 --- a/test/corpus/compile/edge_cases/boolean_true.json +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/test/corpus/compile/edge_cases/dangling_ref.json b/test/corpus/compile/edge_cases/dangling_ref.json deleted file mode 100644 index 76e8aaf49..000000000 --- a/test/corpus/compile/edge_cases/dangling_ref.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": "#/$defs/nonexistent" -} diff --git a/test/corpus/compile/edge_cases/deeply_nested_allof.json b/test/corpus/compile/edge_cases/deeply_nested_allof.json deleted file mode 100644 index 0a860fcc3..000000000 --- a/test/corpus/compile/edge_cases/deeply_nested_allof.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"allOf": [{"type": "string"}]}]}]}]}]}]}]}]}]}] -} diff --git a/test/corpus/compile/edge_cases/duplicate_keys.json b/test/corpus/compile/edge_cases/duplicate_keys.json deleted file mode 100644 index 501add307..000000000 --- a/test/corpus/compile/edge_cases/duplicate_keys.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "name": { "type": "string" }, - "name": { "type": "integer" } - } -} diff --git a/test/corpus/compile/edge_cases/empty_enum.json b/test/corpus/compile/edge_cases/empty_enum.json deleted file mode 100644 index 7ce3ab4e2..000000000 --- a/test/corpus/compile/edge_cases/empty_enum.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "enum": [] -} diff --git a/test/corpus/compile/edge_cases/empty_keyword_values.json b/test/corpus/compile/edge_cases/empty_keyword_values.json deleted file mode 100644 index 408a049e1..000000000 --- a/test/corpus/compile/edge_cases/empty_keyword_values.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": {}, - "required": [], - "allOf": [], - "anyOf": [], - "oneOf": [] -} diff --git a/test/corpus/compile/edge_cases/empty_object.json b/test/corpus/compile/edge_cases/empty_object.json deleted file mode 100644 index 0967ef424..000000000 --- a/test/corpus/compile/edge_cases/empty_object.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/corpus/compile/edge_cases/empty_property_name.json b/test/corpus/compile/edge_cases/empty_property_name.json deleted file mode 100644 index 470493b35..000000000 --- a/test/corpus/compile/edge_cases/empty_property_name.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "": { "type": "string" } - }, - "required": [""] -} diff --git a/test/corpus/compile/edge_cases/extreme_numeric_bounds.json b/test/corpus/compile/edge_cases/extreme_numeric_bounds.json deleted file mode 100644 index 17c59c995..000000000 --- a/test/corpus/compile/edge_cases/extreme_numeric_bounds.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "number", - "minimum": 1e308, - "maximum": 1e308 -} diff --git a/test/corpus/compile/edge_cases/invalid_regex_pattern.json b/test/corpus/compile/edge_cases/invalid_regex_pattern.json deleted file mode 100644 index 1d8c5f893..000000000 --- a/test/corpus/compile/edge_cases/invalid_regex_pattern.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "[invalid(regex" -} diff --git a/test/corpus/compile/edge_cases/number_root.json b/test/corpus/compile/edge_cases/number_root.json deleted file mode 100644 index d81cc0710..000000000 --- a/test/corpus/compile/edge_cases/number_root.json +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/corpus/compile/edge_cases/self_referencing.json b/test/corpus/compile/edge_cases/self_referencing.json deleted file mode 100644 index 215eb669b..000000000 --- a/test/corpus/compile/edge_cases/self_referencing.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": "#/$defs/self", - "$defs": { - "self": { "$ref": "#/$defs/self" } - } -} diff --git a/test/corpus/compile/edge_cases/unicode_keys.json b/test/corpus/compile/edge_cases/unicode_keys.json deleted file mode 100644 index 4d3dcdf3a..000000000 --- a/test/corpus/compile/edge_cases/unicode_keys.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "héllo": { "type": "string" }, - "日本語": { "type": "string" }, - "🎉": { "type": "boolean" } - } -} diff --git a/test/corpus/compile/edge_cases/unknown_keywords.json b/test/corpus/compile/edge_cases/unknown_keywords.json deleted file mode 100644 index 11dba29b7..000000000 --- a/test/corpus/compile/edge_cases/unknown_keywords.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "unknown_keyword": true, - "x-custom-extension": { "foo": "bar" }, - "notAKeyword": [1, 2, 3] -} diff --git a/test/corpus/compile/invalid_json/empty.json b/test/corpus/compile/invalid_json/empty.json deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/corpus/compile/invalid_json/missing_closing_brace.json b/test/corpus/compile/invalid_json/missing_closing_brace.json deleted file mode 100644 index 98232c64f..000000000 --- a/test/corpus/compile/invalid_json/missing_closing_brace.json +++ /dev/null @@ -1 +0,0 @@ -{ diff --git a/test/corpus/compile/invalid_json/missing_comma.json b/test/corpus/compile/invalid_json/missing_comma.json deleted file mode 100644 index 76260bd9e..000000000 --- a/test/corpus/compile/invalid_json/missing_comma.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "string", - "minLength": 1 - "maxLength": 10 -} diff --git a/test/corpus/compile/invalid_json/multiple_roots.json b/test/corpus/compile/invalid_json/multiple_roots.json deleted file mode 100644 index a1de8f070..000000000 --- a/test/corpus/compile/invalid_json/multiple_roots.json +++ /dev/null @@ -1 +0,0 @@ -{"type": "string"} {"type": "number"} diff --git a/test/corpus/compile/invalid_json/plain_text.json b/test/corpus/compile/invalid_json/plain_text.json deleted file mode 100644 index 3cc552724..000000000 --- a/test/corpus/compile/invalid_json/plain_text.json +++ /dev/null @@ -1 +0,0 @@ -hello world this is not json diff --git a/test/corpus/compile/invalid_json/trailing_comma.json b/test/corpus/compile/invalid_json/trailing_comma.json deleted file mode 100644 index faa5cdf84..000000000 --- a/test/corpus/compile/invalid_json/trailing_comma.json +++ /dev/null @@ -1 +0,0 @@ -{"type": "string",} diff --git a/test/corpus/compile/invalid_json/truncated.json b/test/corpus/compile/invalid_json/truncated.json deleted file mode 100644 index 39d2114d9..000000000 --- a/test/corpus/compile/invalid_json/truncated.json +++ /dev/null @@ -1 +0,0 @@ -{"type": "stri \ No newline at end of file diff --git a/test/corpus/compile/invalid_json/unquoted_key.json b/test/corpus/compile/invalid_json/unquoted_key.json deleted file mode 100644 index 3ec45d42f..000000000 --- a/test/corpus/compile/invalid_json/unquoted_key.json +++ /dev/null @@ -1 +0,0 @@ -{type: "string"} diff --git a/test/corpus/compile/invalid_schema/additional_properties_as_number.json b/test/corpus/compile/invalid_schema/additional_properties_as_number.json deleted file mode 100644 index b5a6d7a9c..000000000 --- a/test/corpus/compile/invalid_schema/additional_properties_as_number.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "additionalProperties": 42 -} diff --git a/test/corpus/compile/invalid_schema/items_as_string.json b/test/corpus/compile/invalid_schema/items_as_string.json deleted file mode 100644 index c3ef3a752..000000000 --- a/test/corpus/compile/invalid_schema/items_as_string.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "items": "invalid" -} diff --git a/test/corpus/compile/invalid_schema/max_length_negative.json b/test/corpus/compile/invalid_schema/max_length_negative.json deleted file mode 100644 index 6f9fa21d0..000000000 --- a/test/corpus/compile/invalid_schema/max_length_negative.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "maxLength": -1 -} diff --git a/test/corpus/compile/invalid_schema/multiple_of_negative.json b/test/corpus/compile/invalid_schema/multiple_of_negative.json deleted file mode 100644 index 8be2aaf11..000000000 --- a/test/corpus/compile/invalid_schema/multiple_of_negative.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "multipleOf": -5 -} diff --git a/test/corpus/compile/invalid_schema/multiple_of_zero.json b/test/corpus/compile/invalid_schema/multiple_of_zero.json deleted file mode 100644 index 8d99fc161..000000000 --- a/test/corpus/compile/invalid_schema/multiple_of_zero.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "multipleOf": 0 -} diff --git a/test/corpus/compile/invalid_schema/ref_as_number.json b/test/corpus/compile/invalid_schema/ref_as_number.json deleted file mode 100644 index 5a1803bca..000000000 --- a/test/corpus/compile/invalid_schema/ref_as_number.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": 42 -} diff --git a/test/corpus/compile/invalid_schema/type_as_integer.json b/test/corpus/compile/invalid_schema/type_as_integer.json deleted file mode 100644 index 5e51d9479..000000000 --- a/test/corpus/compile/invalid_schema/type_as_integer.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": 123 -} diff --git a/test/corpus/compile/stress/deep_nesting.json b/test/corpus/compile/stress/deep_nesting.json deleted file mode 100644 index c0bbce46b..000000000 --- a/test/corpus/compile/stress/deep_nesting.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "object", - "properties": { - "child": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/test/corpus/compile/stress/large_enum.json b/test/corpus/compile/stress/large_enum.json deleted file mode 100644 index 6f8ea014b..000000000 --- a/test/corpus/compile/stress/large_enum.json +++ /dev/null @@ -1,505 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "enum": [ - "value_0", - "value_1", - "value_2", - "value_3", - "value_4", - "value_5", - "value_6", - "value_7", - "value_8", - "value_9", - "value_10", - "value_11", - "value_12", - "value_13", - "value_14", - "value_15", - "value_16", - "value_17", - "value_18", - "value_19", - "value_20", - "value_21", - "value_22", - "value_23", - "value_24", - "value_25", - "value_26", - "value_27", - "value_28", - "value_29", - "value_30", - "value_31", - "value_32", - "value_33", - "value_34", - "value_35", - "value_36", - "value_37", - "value_38", - "value_39", - "value_40", - "value_41", - "value_42", - "value_43", - "value_44", - "value_45", - "value_46", - "value_47", - "value_48", - "value_49", - "value_50", - "value_51", - "value_52", - "value_53", - "value_54", - "value_55", - "value_56", - "value_57", - "value_58", - "value_59", - "value_60", - "value_61", - "value_62", - "value_63", - "value_64", - "value_65", - "value_66", - "value_67", - "value_68", - "value_69", - "value_70", - "value_71", - "value_72", - "value_73", - "value_74", - "value_75", - "value_76", - "value_77", - "value_78", - "value_79", - "value_80", - "value_81", - "value_82", - "value_83", - "value_84", - "value_85", - "value_86", - "value_87", - "value_88", - "value_89", - "value_90", - "value_91", - "value_92", - "value_93", - "value_94", - "value_95", - "value_96", - "value_97", - "value_98", - "value_99", - "value_100", - "value_101", - "value_102", - "value_103", - "value_104", - "value_105", - "value_106", - "value_107", - "value_108", - "value_109", - "value_110", - "value_111", - "value_112", - "value_113", - "value_114", - "value_115", - "value_116", - "value_117", - "value_118", - "value_119", - "value_120", - "value_121", - "value_122", - "value_123", - "value_124", - "value_125", - "value_126", - "value_127", - "value_128", - "value_129", - "value_130", - "value_131", - "value_132", - "value_133", - "value_134", - "value_135", - "value_136", - "value_137", - "value_138", - "value_139", - "value_140", - "value_141", - "value_142", - "value_143", - "value_144", - "value_145", - "value_146", - "value_147", - "value_148", - "value_149", - "value_150", - "value_151", - "value_152", - "value_153", - "value_154", - "value_155", - "value_156", - "value_157", - "value_158", - "value_159", - "value_160", - "value_161", - "value_162", - "value_163", - "value_164", - "value_165", - "value_166", - "value_167", - "value_168", - "value_169", - "value_170", - "value_171", - "value_172", - "value_173", - "value_174", - "value_175", - "value_176", - "value_177", - "value_178", - "value_179", - "value_180", - "value_181", - "value_182", - "value_183", - "value_184", - "value_185", - "value_186", - "value_187", - "value_188", - "value_189", - "value_190", - "value_191", - "value_192", - "value_193", - "value_194", - "value_195", - "value_196", - "value_197", - "value_198", - "value_199", - "value_200", - "value_201", - "value_202", - "value_203", - "value_204", - "value_205", - "value_206", - "value_207", - "value_208", - "value_209", - "value_210", - "value_211", - "value_212", - "value_213", - "value_214", - "value_215", - "value_216", - "value_217", - "value_218", - "value_219", - "value_220", - "value_221", - "value_222", - "value_223", - "value_224", - "value_225", - "value_226", - "value_227", - "value_228", - "value_229", - "value_230", - "value_231", - "value_232", - "value_233", - "value_234", - "value_235", - "value_236", - "value_237", - "value_238", - "value_239", - "value_240", - "value_241", - "value_242", - "value_243", - "value_244", - "value_245", - "value_246", - "value_247", - "value_248", - "value_249", - "value_250", - "value_251", - "value_252", - "value_253", - "value_254", - "value_255", - "value_256", - "value_257", - "value_258", - "value_259", - "value_260", - "value_261", - "value_262", - "value_263", - "value_264", - "value_265", - "value_266", - "value_267", - "value_268", - "value_269", - "value_270", - "value_271", - "value_272", - "value_273", - "value_274", - "value_275", - "value_276", - "value_277", - "value_278", - "value_279", - "value_280", - "value_281", - "value_282", - "value_283", - "value_284", - "value_285", - "value_286", - "value_287", - "value_288", - "value_289", - "value_290", - "value_291", - "value_292", - "value_293", - "value_294", - "value_295", - "value_296", - "value_297", - "value_298", - "value_299", - "value_300", - "value_301", - "value_302", - "value_303", - "value_304", - "value_305", - "value_306", - "value_307", - "value_308", - "value_309", - "value_310", - "value_311", - "value_312", - "value_313", - "value_314", - "value_315", - "value_316", - "value_317", - "value_318", - "value_319", - "value_320", - "value_321", - "value_322", - "value_323", - "value_324", - "value_325", - "value_326", - "value_327", - "value_328", - "value_329", - "value_330", - "value_331", - "value_332", - "value_333", - "value_334", - "value_335", - "value_336", - "value_337", - "value_338", - "value_339", - "value_340", - "value_341", - "value_342", - "value_343", - "value_344", - "value_345", - "value_346", - "value_347", - "value_348", - "value_349", - "value_350", - "value_351", - "value_352", - "value_353", - "value_354", - "value_355", - "value_356", - "value_357", - "value_358", - "value_359", - "value_360", - "value_361", - "value_362", - "value_363", - "value_364", - "value_365", - "value_366", - "value_367", - "value_368", - "value_369", - "value_370", - "value_371", - "value_372", - "value_373", - "value_374", - "value_375", - "value_376", - "value_377", - "value_378", - "value_379", - "value_380", - "value_381", - "value_382", - "value_383", - "value_384", - "value_385", - "value_386", - "value_387", - "value_388", - "value_389", - "value_390", - "value_391", - "value_392", - "value_393", - "value_394", - "value_395", - "value_396", - "value_397", - "value_398", - "value_399", - "value_400", - "value_401", - "value_402", - "value_403", - "value_404", - "value_405", - "value_406", - "value_407", - "value_408", - "value_409", - "value_410", - "value_411", - "value_412", - "value_413", - "value_414", - "value_415", - "value_416", - "value_417", - "value_418", - "value_419", - "value_420", - "value_421", - "value_422", - "value_423", - "value_424", - "value_425", - "value_426", - "value_427", - "value_428", - "value_429", - "value_430", - "value_431", - "value_432", - "value_433", - "value_434", - "value_435", - "value_436", - "value_437", - "value_438", - "value_439", - "value_440", - "value_441", - "value_442", - "value_443", - "value_444", - "value_445", - "value_446", - "value_447", - "value_448", - "value_449", - "value_450", - "value_451", - "value_452", - "value_453", - "value_454", - "value_455", - "value_456", - "value_457", - "value_458", - "value_459", - "value_460", - "value_461", - "value_462", - "value_463", - "value_464", - "value_465", - "value_466", - "value_467", - "value_468", - "value_469", - "value_470", - "value_471", - "value_472", - "value_473", - "value_474", - "value_475", - "value_476", - "value_477", - "value_478", - "value_479", - "value_480", - "value_481", - "value_482", - "value_483", - "value_484", - "value_485", - "value_486", - "value_487", - "value_488", - "value_489", - "value_490", - "value_491", - "value_492", - "value_493", - "value_494", - "value_495", - "value_496", - "value_497", - "value_498", - "value_499" - ] -} diff --git a/test/corpus/compile/stress/many_allof.json b/test/corpus/compile/stress/many_allof.json deleted file mode 100644 index 846eff7bb..000000000 --- a/test/corpus/compile/stress/many_allof.json +++ /dev/null @@ -1,355 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "allOf": [ - { - "properties": { - "prop_0": { - "type": "string" - } - } - }, - { - "properties": { - "prop_1": { - "type": "string" - } - } - }, - { - "properties": { - "prop_2": { - "type": "string" - } - } - }, - { - "properties": { - "prop_3": { - "type": "string" - } - } - }, - { - "properties": { - "prop_4": { - "type": "string" - } - } - }, - { - "properties": { - "prop_5": { - "type": "string" - } - } - }, - { - "properties": { - "prop_6": { - "type": "string" - } - } - }, - { - "properties": { - "prop_7": { - "type": "string" - } - } - }, - { - "properties": { - "prop_8": { - "type": "string" - } - } - }, - { - "properties": { - "prop_9": { - "type": "string" - } - } - }, - { - "properties": { - "prop_10": { - "type": "string" - } - } - }, - { - "properties": { - "prop_11": { - "type": "string" - } - } - }, - { - "properties": { - "prop_12": { - "type": "string" - } - } - }, - { - "properties": { - "prop_13": { - "type": "string" - } - } - }, - { - "properties": { - "prop_14": { - "type": "string" - } - } - }, - { - "properties": { - "prop_15": { - "type": "string" - } - } - }, - { - "properties": { - "prop_16": { - "type": "string" - } - } - }, - { - "properties": { - "prop_17": { - "type": "string" - } - } - }, - { - "properties": { - "prop_18": { - "type": "string" - } - } - }, - { - "properties": { - "prop_19": { - "type": "string" - } - } - }, - { - "properties": { - "prop_20": { - "type": "string" - } - } - }, - { - "properties": { - "prop_21": { - "type": "string" - } - } - }, - { - "properties": { - "prop_22": { - "type": "string" - } - } - }, - { - "properties": { - "prop_23": { - "type": "string" - } - } - }, - { - "properties": { - "prop_24": { - "type": "string" - } - } - }, - { - "properties": { - "prop_25": { - "type": "string" - } - } - }, - { - "properties": { - "prop_26": { - "type": "string" - } - } - }, - { - "properties": { - "prop_27": { - "type": "string" - } - } - }, - { - "properties": { - "prop_28": { - "type": "string" - } - } - }, - { - "properties": { - "prop_29": { - "type": "string" - } - } - }, - { - "properties": { - "prop_30": { - "type": "string" - } - } - }, - { - "properties": { - "prop_31": { - "type": "string" - } - } - }, - { - "properties": { - "prop_32": { - "type": "string" - } - } - }, - { - "properties": { - "prop_33": { - "type": "string" - } - } - }, - { - "properties": { - "prop_34": { - "type": "string" - } - } - }, - { - "properties": { - "prop_35": { - "type": "string" - } - } - }, - { - "properties": { - "prop_36": { - "type": "string" - } - } - }, - { - "properties": { - "prop_37": { - "type": "string" - } - } - }, - { - "properties": { - "prop_38": { - "type": "string" - } - } - }, - { - "properties": { - "prop_39": { - "type": "string" - } - } - }, - { - "properties": { - "prop_40": { - "type": "string" - } - } - }, - { - "properties": { - "prop_41": { - "type": "string" - } - } - }, - { - "properties": { - "prop_42": { - "type": "string" - } - } - }, - { - "properties": { - "prop_43": { - "type": "string" - } - } - }, - { - "properties": { - "prop_44": { - "type": "string" - } - } - }, - { - "properties": { - "prop_45": { - "type": "string" - } - } - }, - { - "properties": { - "prop_46": { - "type": "string" - } - } - }, - { - "properties": { - "prop_47": { - "type": "string" - } - } - }, - { - "properties": { - "prop_48": { - "type": "string" - } - } - }, - { - "properties": { - "prop_49": { - "type": "string" - } - } - } - ] -} diff --git a/test/corpus/compile/stress/many_pattern_properties.json b/test/corpus/compile/stress/many_pattern_properties.json deleted file mode 100644 index 27311a510..000000000 --- a/test/corpus/compile/stress/many_pattern_properties.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "^prefix_0_": { - "type": "string" - }, - "^prefix_1_": { - "type": "string" - }, - "^prefix_2_": { - "type": "string" - }, - "^prefix_3_": { - "type": "string" - }, - "^prefix_4_": { - "type": "string" - }, - "^prefix_5_": { - "type": "string" - }, - "^prefix_6_": { - "type": "string" - }, - "^prefix_7_": { - "type": "string" - }, - "^prefix_8_": { - "type": "string" - }, - "^prefix_9_": { - "type": "string" - }, - "^prefix_10_": { - "type": "string" - }, - "^prefix_11_": { - "type": "string" - }, - "^prefix_12_": { - "type": "string" - }, - "^prefix_13_": { - "type": "string" - }, - "^prefix_14_": { - "type": "string" - }, - "^prefix_15_": { - "type": "string" - }, - "^prefix_16_": { - "type": "string" - }, - "^prefix_17_": { - "type": "string" - }, - "^prefix_18_": { - "type": "string" - }, - "^prefix_19_": { - "type": "string" - }, - "^prefix_20_": { - "type": "string" - }, - "^prefix_21_": { - "type": "string" - }, - "^prefix_22_": { - "type": "string" - }, - "^prefix_23_": { - "type": "string" - }, - "^prefix_24_": { - "type": "string" - }, - "^prefix_25_": { - "type": "string" - }, - "^prefix_26_": { - "type": "string" - }, - "^prefix_27_": { - "type": "string" - }, - "^prefix_28_": { - "type": "string" - }, - "^prefix_29_": { - "type": "string" - }, - "^prefix_30_": { - "type": "string" - }, - "^prefix_31_": { - "type": "string" - }, - "^prefix_32_": { - "type": "string" - }, - "^prefix_33_": { - "type": "string" - }, - "^prefix_34_": { - "type": "string" - }, - "^prefix_35_": { - "type": "string" - }, - "^prefix_36_": { - "type": "string" - }, - "^prefix_37_": { - "type": "string" - }, - "^prefix_38_": { - "type": "string" - }, - "^prefix_39_": { - "type": "string" - }, - "^prefix_40_": { - "type": "string" - }, - "^prefix_41_": { - "type": "string" - }, - "^prefix_42_": { - "type": "string" - }, - "^prefix_43_": { - "type": "string" - }, - "^prefix_44_": { - "type": "string" - }, - "^prefix_45_": { - "type": "string" - }, - "^prefix_46_": { - "type": "string" - }, - "^prefix_47_": { - "type": "string" - }, - "^prefix_48_": { - "type": "string" - }, - "^prefix_49_": { - "type": "string" - } - } -} diff --git a/test/corpus/compile/stress/many_properties.json b/test/corpus/compile/stress/many_properties.json deleted file mode 100644 index eec9da920..000000000 --- a/test/corpus/compile/stress/many_properties.json +++ /dev/null @@ -1,858 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "field_0": { - "type": "string", - "minLength": 1 - }, - "field_1": { - "type": "string", - "minLength": 1 - }, - "field_2": { - "type": "string", - "minLength": 1 - }, - "field_3": { - "type": "string", - "minLength": 1 - }, - "field_4": { - "type": "string", - "minLength": 1 - }, - "field_5": { - "type": "string", - "minLength": 1 - }, - "field_6": { - "type": "string", - "minLength": 1 - }, - "field_7": { - "type": "string", - "minLength": 1 - }, - "field_8": { - "type": "string", - "minLength": 1 - }, - "field_9": { - "type": "string", - "minLength": 1 - }, - "field_10": { - "type": "string", - "minLength": 1 - }, - "field_11": { - "type": "string", - "minLength": 1 - }, - "field_12": { - "type": "string", - "minLength": 1 - }, - "field_13": { - "type": "string", - "minLength": 1 - }, - "field_14": { - "type": "string", - "minLength": 1 - }, - "field_15": { - "type": "string", - "minLength": 1 - }, - "field_16": { - "type": "string", - "minLength": 1 - }, - "field_17": { - "type": "string", - "minLength": 1 - }, - "field_18": { - "type": "string", - "minLength": 1 - }, - "field_19": { - "type": "string", - "minLength": 1 - }, - "field_20": { - "type": "string", - "minLength": 1 - }, - "field_21": { - "type": "string", - "minLength": 1 - }, - "field_22": { - "type": "string", - "minLength": 1 - }, - "field_23": { - "type": "string", - "minLength": 1 - }, - "field_24": { - "type": "string", - "minLength": 1 - }, - "field_25": { - "type": "string", - "minLength": 1 - }, - "field_26": { - "type": "string", - "minLength": 1 - }, - "field_27": { - "type": "string", - "minLength": 1 - }, - "field_28": { - "type": "string", - "minLength": 1 - }, - "field_29": { - "type": "string", - "minLength": 1 - }, - "field_30": { - "type": "string", - "minLength": 1 - }, - "field_31": { - "type": "string", - "minLength": 1 - }, - "field_32": { - "type": "string", - "minLength": 1 - }, - "field_33": { - "type": "string", - "minLength": 1 - }, - "field_34": { - "type": "string", - "minLength": 1 - }, - "field_35": { - "type": "string", - "minLength": 1 - }, - "field_36": { - "type": "string", - "minLength": 1 - }, - "field_37": { - "type": "string", - "minLength": 1 - }, - "field_38": { - "type": "string", - "minLength": 1 - }, - "field_39": { - "type": "string", - "minLength": 1 - }, - "field_40": { - "type": "string", - "minLength": 1 - }, - "field_41": { - "type": "string", - "minLength": 1 - }, - "field_42": { - "type": "string", - "minLength": 1 - }, - "field_43": { - "type": "string", - "minLength": 1 - }, - "field_44": { - "type": "string", - "minLength": 1 - }, - "field_45": { - "type": "string", - "minLength": 1 - }, - "field_46": { - "type": "string", - "minLength": 1 - }, - "field_47": { - "type": "string", - "minLength": 1 - }, - "field_48": { - "type": "string", - "minLength": 1 - }, - "field_49": { - "type": "string", - "minLength": 1 - }, - "field_50": { - "type": "string", - "minLength": 1 - }, - "field_51": { - "type": "string", - "minLength": 1 - }, - "field_52": { - "type": "string", - "minLength": 1 - }, - "field_53": { - "type": "string", - "minLength": 1 - }, - "field_54": { - "type": "string", - "minLength": 1 - }, - "field_55": { - "type": "string", - "minLength": 1 - }, - "field_56": { - "type": "string", - "minLength": 1 - }, - "field_57": { - "type": "string", - "minLength": 1 - }, - "field_58": { - "type": "string", - "minLength": 1 - }, - "field_59": { - "type": "string", - "minLength": 1 - }, - "field_60": { - "type": "string", - "minLength": 1 - }, - "field_61": { - "type": "string", - "minLength": 1 - }, - "field_62": { - "type": "string", - "minLength": 1 - }, - "field_63": { - "type": "string", - "minLength": 1 - }, - "field_64": { - "type": "string", - "minLength": 1 - }, - "field_65": { - "type": "string", - "minLength": 1 - }, - "field_66": { - "type": "string", - "minLength": 1 - }, - "field_67": { - "type": "string", - "minLength": 1 - }, - "field_68": { - "type": "string", - "minLength": 1 - }, - "field_69": { - "type": "string", - "minLength": 1 - }, - "field_70": { - "type": "string", - "minLength": 1 - }, - "field_71": { - "type": "string", - "minLength": 1 - }, - "field_72": { - "type": "string", - "minLength": 1 - }, - "field_73": { - "type": "string", - "minLength": 1 - }, - "field_74": { - "type": "string", - "minLength": 1 - }, - "field_75": { - "type": "string", - "minLength": 1 - }, - "field_76": { - "type": "string", - "minLength": 1 - }, - "field_77": { - "type": "string", - "minLength": 1 - }, - "field_78": { - "type": "string", - "minLength": 1 - }, - "field_79": { - "type": "string", - "minLength": 1 - }, - "field_80": { - "type": "string", - "minLength": 1 - }, - "field_81": { - "type": "string", - "minLength": 1 - }, - "field_82": { - "type": "string", - "minLength": 1 - }, - "field_83": { - "type": "string", - "minLength": 1 - }, - "field_84": { - "type": "string", - "minLength": 1 - }, - "field_85": { - "type": "string", - "minLength": 1 - }, - "field_86": { - "type": "string", - "minLength": 1 - }, - "field_87": { - "type": "string", - "minLength": 1 - }, - "field_88": { - "type": "string", - "minLength": 1 - }, - "field_89": { - "type": "string", - "minLength": 1 - }, - "field_90": { - "type": "string", - "minLength": 1 - }, - "field_91": { - "type": "string", - "minLength": 1 - }, - "field_92": { - "type": "string", - "minLength": 1 - }, - "field_93": { - "type": "string", - "minLength": 1 - }, - "field_94": { - "type": "string", - "minLength": 1 - }, - "field_95": { - "type": "string", - "minLength": 1 - }, - "field_96": { - "type": "string", - "minLength": 1 - }, - "field_97": { - "type": "string", - "minLength": 1 - }, - "field_98": { - "type": "string", - "minLength": 1 - }, - "field_99": { - "type": "string", - "minLength": 1 - }, - "field_100": { - "type": "string", - "minLength": 1 - }, - "field_101": { - "type": "string", - "minLength": 1 - }, - "field_102": { - "type": "string", - "minLength": 1 - }, - "field_103": { - "type": "string", - "minLength": 1 - }, - "field_104": { - "type": "string", - "minLength": 1 - }, - "field_105": { - "type": "string", - "minLength": 1 - }, - "field_106": { - "type": "string", - "minLength": 1 - }, - "field_107": { - "type": "string", - "minLength": 1 - }, - "field_108": { - "type": "string", - "minLength": 1 - }, - "field_109": { - "type": "string", - "minLength": 1 - }, - "field_110": { - "type": "string", - "minLength": 1 - }, - "field_111": { - "type": "string", - "minLength": 1 - }, - "field_112": { - "type": "string", - "minLength": 1 - }, - "field_113": { - "type": "string", - "minLength": 1 - }, - "field_114": { - "type": "string", - "minLength": 1 - }, - "field_115": { - "type": "string", - "minLength": 1 - }, - "field_116": { - "type": "string", - "minLength": 1 - }, - "field_117": { - "type": "string", - "minLength": 1 - }, - "field_118": { - "type": "string", - "minLength": 1 - }, - "field_119": { - "type": "string", - "minLength": 1 - }, - "field_120": { - "type": "string", - "minLength": 1 - }, - "field_121": { - "type": "string", - "minLength": 1 - }, - "field_122": { - "type": "string", - "minLength": 1 - }, - "field_123": { - "type": "string", - "minLength": 1 - }, - "field_124": { - "type": "string", - "minLength": 1 - }, - "field_125": { - "type": "string", - "minLength": 1 - }, - "field_126": { - "type": "string", - "minLength": 1 - }, - "field_127": { - "type": "string", - "minLength": 1 - }, - "field_128": { - "type": "string", - "minLength": 1 - }, - "field_129": { - "type": "string", - "minLength": 1 - }, - "field_130": { - "type": "string", - "minLength": 1 - }, - "field_131": { - "type": "string", - "minLength": 1 - }, - "field_132": { - "type": "string", - "minLength": 1 - }, - "field_133": { - "type": "string", - "minLength": 1 - }, - "field_134": { - "type": "string", - "minLength": 1 - }, - "field_135": { - "type": "string", - "minLength": 1 - }, - "field_136": { - "type": "string", - "minLength": 1 - }, - "field_137": { - "type": "string", - "minLength": 1 - }, - "field_138": { - "type": "string", - "minLength": 1 - }, - "field_139": { - "type": "string", - "minLength": 1 - }, - "field_140": { - "type": "string", - "minLength": 1 - }, - "field_141": { - "type": "string", - "minLength": 1 - }, - "field_142": { - "type": "string", - "minLength": 1 - }, - "field_143": { - "type": "string", - "minLength": 1 - }, - "field_144": { - "type": "string", - "minLength": 1 - }, - "field_145": { - "type": "string", - "minLength": 1 - }, - "field_146": { - "type": "string", - "minLength": 1 - }, - "field_147": { - "type": "string", - "minLength": 1 - }, - "field_148": { - "type": "string", - "minLength": 1 - }, - "field_149": { - "type": "string", - "minLength": 1 - }, - "field_150": { - "type": "string", - "minLength": 1 - }, - "field_151": { - "type": "string", - "minLength": 1 - }, - "field_152": { - "type": "string", - "minLength": 1 - }, - "field_153": { - "type": "string", - "minLength": 1 - }, - "field_154": { - "type": "string", - "minLength": 1 - }, - "field_155": { - "type": "string", - "minLength": 1 - }, - "field_156": { - "type": "string", - "minLength": 1 - }, - "field_157": { - "type": "string", - "minLength": 1 - }, - "field_158": { - "type": "string", - "minLength": 1 - }, - "field_159": { - "type": "string", - "minLength": 1 - }, - "field_160": { - "type": "string", - "minLength": 1 - }, - "field_161": { - "type": "string", - "minLength": 1 - }, - "field_162": { - "type": "string", - "minLength": 1 - }, - "field_163": { - "type": "string", - "minLength": 1 - }, - "field_164": { - "type": "string", - "minLength": 1 - }, - "field_165": { - "type": "string", - "minLength": 1 - }, - "field_166": { - "type": "string", - "minLength": 1 - }, - "field_167": { - "type": "string", - "minLength": 1 - }, - "field_168": { - "type": "string", - "minLength": 1 - }, - "field_169": { - "type": "string", - "minLength": 1 - }, - "field_170": { - "type": "string", - "minLength": 1 - }, - "field_171": { - "type": "string", - "minLength": 1 - }, - "field_172": { - "type": "string", - "minLength": 1 - }, - "field_173": { - "type": "string", - "minLength": 1 - }, - "field_174": { - "type": "string", - "minLength": 1 - }, - "field_175": { - "type": "string", - "minLength": 1 - }, - "field_176": { - "type": "string", - "minLength": 1 - }, - "field_177": { - "type": "string", - "minLength": 1 - }, - "field_178": { - "type": "string", - "minLength": 1 - }, - "field_179": { - "type": "string", - "minLength": 1 - }, - "field_180": { - "type": "string", - "minLength": 1 - }, - "field_181": { - "type": "string", - "minLength": 1 - }, - "field_182": { - "type": "string", - "minLength": 1 - }, - "field_183": { - "type": "string", - "minLength": 1 - }, - "field_184": { - "type": "string", - "minLength": 1 - }, - "field_185": { - "type": "string", - "minLength": 1 - }, - "field_186": { - "type": "string", - "minLength": 1 - }, - "field_187": { - "type": "string", - "minLength": 1 - }, - "field_188": { - "type": "string", - "minLength": 1 - }, - "field_189": { - "type": "string", - "minLength": 1 - }, - "field_190": { - "type": "string", - "minLength": 1 - }, - "field_191": { - "type": "string", - "minLength": 1 - }, - "field_192": { - "type": "string", - "minLength": 1 - }, - "field_193": { - "type": "string", - "minLength": 1 - }, - "field_194": { - "type": "string", - "minLength": 1 - }, - "field_195": { - "type": "string", - "minLength": 1 - }, - "field_196": { - "type": "string", - "minLength": 1 - }, - "field_197": { - "type": "string", - "minLength": 1 - }, - "field_198": { - "type": "string", - "minLength": 1 - }, - "field_199": { - "type": "string", - "minLength": 1 - } - }, - "required": [ - "field_0", - "field_1", - "field_2", - "field_3", - "field_4", - "field_5", - "field_6", - "field_7", - "field_8", - "field_9", - "field_10", - "field_11", - "field_12", - "field_13", - "field_14", - "field_15", - "field_16", - "field_17", - "field_18", - "field_19", - "field_20", - "field_21", - "field_22", - "field_23", - "field_24", - "field_25", - "field_26", - "field_27", - "field_28", - "field_29", - "field_30", - "field_31", - "field_32", - "field_33", - "field_34", - "field_35", - "field_36", - "field_37", - "field_38", - "field_39", - "field_40", - "field_41", - "field_42", - "field_43", - "field_44", - "field_45", - "field_46", - "field_47", - "field_48", - "field_49" - ] -} diff --git a/test/corpus/compile/stress/many_required.json b/test/corpus/compile/stress/many_required.json deleted file mode 100644 index 81ea1c2d9..000000000 --- a/test/corpus/compile/stress/many_required.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "required": [ - "required_field_0", - "required_field_1", - "required_field_2", - "required_field_3", - "required_field_4", - "required_field_5", - "required_field_6", - "required_field_7", - "required_field_8", - "required_field_9", - "required_field_10", - "required_field_11", - "required_field_12", - "required_field_13", - "required_field_14", - "required_field_15", - "required_field_16", - "required_field_17", - "required_field_18", - "required_field_19", - "required_field_20", - "required_field_21", - "required_field_22", - "required_field_23", - "required_field_24", - "required_field_25", - "required_field_26", - "required_field_27", - "required_field_28", - "required_field_29", - "required_field_30", - "required_field_31", - "required_field_32", - "required_field_33", - "required_field_34", - "required_field_35", - "required_field_36", - "required_field_37", - "required_field_38", - "required_field_39", - "required_field_40", - "required_field_41", - "required_field_42", - "required_field_43", - "required_field_44", - "required_field_45", - "required_field_46", - "required_field_47", - "required_field_48", - "required_field_49", - "required_field_50", - "required_field_51", - "required_field_52", - "required_field_53", - "required_field_54", - "required_field_55", - "required_field_56", - "required_field_57", - "required_field_58", - "required_field_59", - "required_field_60", - "required_field_61", - "required_field_62", - "required_field_63", - "required_field_64", - "required_field_65", - "required_field_66", - "required_field_67", - "required_field_68", - "required_field_69", - "required_field_70", - "required_field_71", - "required_field_72", - "required_field_73", - "required_field_74", - "required_field_75", - "required_field_76", - "required_field_77", - "required_field_78", - "required_field_79", - "required_field_80", - "required_field_81", - "required_field_82", - "required_field_83", - "required_field_84", - "required_field_85", - "required_field_86", - "required_field_87", - "required_field_88", - "required_field_89", - "required_field_90", - "required_field_91", - "required_field_92", - "required_field_93", - "required_field_94", - "required_field_95", - "required_field_96", - "required_field_97", - "required_field_98", - "required_field_99" - ] -} diff --git a/test/corpus/compile/unknown_dialect/close_but_wrong.json b/test/corpus/compile/unknown_dialect/close_but_wrong.json deleted file mode 100644 index 7a225d9fe..000000000 --- a/test/corpus/compile/unknown_dialect/close_but_wrong.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#but-wrong", - "type": "string" -} diff --git a/test/corpus/compile/unknown_dialect/empty_dialect.json b/test/corpus/compile/unknown_dialect/empty_dialect.json deleted file mode 100644 index 09ff5aee9..000000000 --- a/test/corpus/compile/unknown_dialect/empty_dialect.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "", - "type": "string" -} diff --git a/test/corpus/compile/unknown_dialect/future_draft.json b/test/corpus/compile/unknown_dialect/future_draft.json deleted file mode 100644 index 84ea5c5e5..000000000 --- a/test/corpus/compile/unknown_dialect/future_draft.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2099-01/schema", - "type": "string" -} diff --git a/test/corpus/compile/unknown_dialect/unknown_url.json b/test/corpus/compile/unknown_dialect/unknown_url.json deleted file mode 100644 index 5e2e8cfe2..000000000 --- a/test/corpus/compile/unknown_dialect/unknown_url.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "http://example.com/unknown-dialect", - "type": "string" -} diff --git a/test/corpus/compile/unknown_dialect/urn_dialect.json b/test/corpus/compile/unknown_dialect/urn_dialect.json deleted file mode 100644 index aebafd902..000000000 --- a/test/corpus/compile/unknown_dialect/urn_dialect.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "urn:not:a:real:schema", - "type": "object", - "properties": { - "name": { "type": "string" } - } -} diff --git a/test/corpus/compile/valid/array_constraints.json b/test/corpus/compile/valid/array_constraints.json deleted file mode 100644 index 3ffacc0f2..000000000 --- a/test/corpus/compile/valid/array_constraints.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "array", - "prefixItems": [ - { "type": "string" }, - { "type": "integer" } - ], - "items": { "type": "boolean" }, - "minItems": 1, - "maxItems": 10, - "uniqueItems": true, - "contains": { "type": "string" } -} diff --git a/test/corpus/compile/valid/combinators.json b/test/corpus/compile/valid/combinators.json deleted file mode 100644 index 1e71d67cc..000000000 --- a/test/corpus/compile/valid/combinators.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "allOf": [ - { "type": "object" }, - { - "anyOf": [ - { "required": ["a"] }, - { "required": ["b"] } - ] - }, - { - "oneOf": [ - { "properties": { "x": { "type": "string" } } }, - { "properties": { "x": { "type": "number" } } } - ] - } - ] -} diff --git a/test/corpus/compile/valid/complex_object.json b/test/corpus/compile/valid/complex_object.json deleted file mode 100644 index c2c2662f4..000000000 --- a/test/corpus/compile/valid/complex_object.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "name": { "type": "string", "minLength": 1, "maxLength": 100 }, - "age": { "type": "integer", "minimum": 0, "maximum": 150 }, - "email": { "type": "string", "format": "email" }, - "address": { - "type": "object", - "properties": { - "street": { "type": "string" }, - "city": { "type": "string" }, - "zip": { "type": "string", "pattern": "^[0-9]{5}$" } - }, - "required": ["street", "city"] - }, - "tags": { - "type": "array", - "items": { "type": "string" }, - "minItems": 0, - "maxItems": 20, - "uniqueItems": true - }, - "role": { - "enum": ["admin", "user", "guest"] - } - }, - "required": ["name", "email"], - "additionalProperties": false -} diff --git a/test/corpus/compile/valid/conditional.json b/test/corpus/compile/valid/conditional.json deleted file mode 100644 index e139a29c9..000000000 --- a/test/corpus/compile/valid/conditional.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "if": { - "properties": { "kind": { "const": "a" } } - }, - "then": { - "required": ["value_a"] - }, - "else": { - "required": ["value_b"] - } -} diff --git a/test/corpus/compile/valid/draft2019.json b/test/corpus/compile/valid/draft2019.json deleted file mode 100644 index a8f945a34..000000000 --- a/test/corpus/compile/valid/draft2019.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "type": "object", - "properties": { - "name": { "type": "string" }, - "age": { "type": "integer" } - }, - "dependentRequired": { - "age": ["name"] - }, - "dependentSchemas": { - "name": { - "properties": { - "nickname": { "type": "string" } - } - } - }, - "unevaluatedProperties": false -} diff --git a/test/corpus/compile/valid/draft2020.json b/test/corpus/compile/valid/draft2020.json deleted file mode 100644 index 942b344f4..000000000 --- a/test/corpus/compile/valid/draft2020.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "$defs": { - "base": { - "$dynamicAnchor": "ext", - "type": "object" - } - }, - "properties": { - "items": { - "type": "array", - "prefixItems": [{ "type": "string" }], - "items": { "type": "integer" } - } - }, - "unevaluatedProperties": false -} diff --git a/test/corpus/compile/valid/draft4.json b/test/corpus/compile/valid/draft4.json deleted file mode 100644 index 9f8de340a..000000000 --- a/test/corpus/compile/valid/draft4.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "properties": { - "id": { "type": "integer" }, - "name": { "type": "string" } - }, - "required": ["id"], - "additionalProperties": false -} diff --git a/test/corpus/compile/valid/draft6.json b/test/corpus/compile/valid/draft6.json deleted file mode 100644 index fc09c7834..000000000 --- a/test/corpus/compile/valid/draft6.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-06/schema#", - "type": "object", - "properties": { - "tag": { "type": "string", "const": "v1" } - }, - "propertyNames": { "pattern": "^[a-z]" }, - "contains": { "type": "number" } -} diff --git a/test/corpus/compile/valid/draft7.json b/test/corpus/compile/valid/draft7.json deleted file mode 100644 index 0aac169ac..000000000 --- a/test/corpus/compile/valid/draft7.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "email": { "type": "string", "format": "email" } - }, - "if": { "required": ["email"] }, - "then": { "properties": { "verified": { "type": "boolean" } } }, - "else": true -} diff --git a/test/corpus/compile/valid/not_keyword.json b/test/corpus/compile/valid/not_keyword.json deleted file mode 100644 index f80a66cfa..000000000 --- a/test/corpus/compile/valid/not_keyword.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "not": { - "type": "null" - } -} diff --git a/test/corpus/compile/valid/numeric_constraints.json b/test/corpus/compile/valid/numeric_constraints.json deleted file mode 100644 index 213109cf1..000000000 --- a/test/corpus/compile/valid/numeric_constraints.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "number", - "minimum": 0, - "maximum": 100, - "exclusiveMinimum": 0, - "exclusiveMaximum": 100, - "multipleOf": 0.5 -} diff --git a/test/corpus/compile/valid/openapi_3_1.json b/test/corpus/compile/valid/openapi_3_1.json deleted file mode 100644 index 5d7abdca0..000000000 --- a/test/corpus/compile/valid/openapi_3_1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "name": { "type": "string" }, - "age": { "type": "integer" } - }, - "required": ["name"] -} diff --git a/test/corpus/compile/valid/openapi_3_2.json b/test/corpus/compile/valid/openapi_3_2.json deleted file mode 100644 index abf3bf89e..000000000 --- a/test/corpus/compile/valid/openapi_3_2.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://spec.openapis.org/oas/3.2/dialect/2025-09-17", - "type": "object", - "properties": { - "id": { "type": "integer" }, - "label": { "type": "string", "minLength": 1 } - }, - "required": ["id"] -} diff --git a/test/corpus/compile/valid/pattern_properties.json b/test/corpus/compile/valid/pattern_properties.json deleted file mode 100644 index 1ce0e1d69..000000000 --- a/test/corpus/compile/valid/pattern_properties.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "^x-": { "type": "string" }, - "^[0-9]+$": { "type": "integer" } - }, - "additionalProperties": { "type": "boolean" } -} diff --git a/test/corpus/compile/valid/properties.json b/test/corpus/compile/valid/properties.json deleted file mode 100644 index 4a55a78e9..000000000 --- a/test/corpus/compile/valid/properties.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "name": { "type": "string" }, - "age": { "type": "integer", "minimum": 0 } - }, - "required": ["name"] -} diff --git a/test/corpus/compile/valid/refs_and_defs.json b/test/corpus/compile/valid/refs_and_defs.json deleted file mode 100644 index 1d35d5381..000000000 --- a/test/corpus/compile/valid/refs_and_defs.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": "#/$defs/address", - "$defs": { - "address": { - "type": "object", - "properties": { - "street": { "type": "string" }, - "city": { "$ref": "#/$defs/city" } - } - }, - "city": { - "type": "string", - "minLength": 1 - } - } -} diff --git a/test/corpus/compile/valid/string_constraints.json b/test/corpus/compile/valid/string_constraints.json deleted file mode 100644 index 7f671aea9..000000000 --- a/test/corpus/compile/valid/string_constraints.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "minLength": 1, - "maxLength": 255, - "pattern": "^[a-zA-Z0-9]+$" -} diff --git a/test/corpus/compile/valid/type_array.json b/test/corpus/compile/valid/type_array.json deleted file mode 100644 index 65110ce79..000000000 --- a/test/corpus/compile/valid/type_array.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": ["string", "number"] -} diff --git a/test/corpus/compile/valid/type_string.json b/test/corpus/compile/valid/type_string.json deleted file mode 100644 index d423e9e6c..000000000 --- a/test/corpus/compile/valid/type_string.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string" -} diff --git a/test/evaluator/evaluator_test.cc b/test/evaluator/evaluator_test.cc index d256ab45c..1eaad9aa4 100644 --- a/test/evaluator/evaluator_test.cc +++ b/test/evaluator/evaluator_test.cc @@ -315,7 +315,7 @@ TEST(Evaluator, format_assertion_vocabulary_unsupported) { } } -TEST(Evaluator, invalid_additional_properties_type_crash) { +TEST(Evaluator, compile_rejects_invalid_additional_properties_type) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", @@ -326,13 +326,13 @@ TEST(Evaluator, invalid_additional_properties_type_crash) { sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to throw"; + FAIL() << "The compile function was expected to reject the schema"; } catch (const std::exception &) { SUCCEED(); } } -TEST(Evaluator, invalid_items_type_crash) { +TEST(Evaluator, compile_rejects_invalid_items_type) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "items": "invalid" @@ -342,13 +342,13 @@ TEST(Evaluator, invalid_items_type_crash) { sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to throw"; + FAIL() << "The compile function was expected to reject the schema"; } catch (const std::exception &) { SUCCEED(); } } -TEST(Evaluator, number_root_crash) { +TEST(Evaluator, compile_rejects_non_schema_root) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON( 1 )JSON")}; @@ -357,7 +357,7 @@ TEST(Evaluator, number_root_crash) { sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to throw"; + FAIL() << "The compile function was expected to reject the schema"; } catch (const std::exception &) { SUCCEED(); } From 98b76be5e0037c7e4667893937f585b148bb4b49 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Sat, 11 Apr 2026 02:11:11 +0000 Subject: [PATCH 10/11] test: align evaluator invalid schema tests Signed-off-by: Vaibhav mittal --- test/evaluator/evaluator_test.cc | 49 +++++++++++++------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/test/evaluator/evaluator_test.cc b/test/evaluator/evaluator_test.cc index 1eaad9aa4..de71f3630 100644 --- a/test/evaluator/evaluator_test.cc +++ b/test/evaluator/evaluator_test.cc @@ -315,50 +315,39 @@ TEST(Evaluator, format_assertion_vocabulary_unsupported) { } } -TEST(Evaluator, compile_rejects_invalid_additional_properties_type) { +TEST(Evaluator, invalid_additional_properties_type) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": 42 })JSON")}; - try { - sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, - sourcemeta::core::schema_resolver, - sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to reject the schema"; - } catch (const std::exception &) { - SUCCEED(); - } + EXPECT_THROW( + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler), + sourcemeta::core::SchemaError); } -TEST(Evaluator, compile_rejects_invalid_items_type) { +TEST(Evaluator, invalid_items_type) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "items": "invalid" })JSON")}; - try { - sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, - sourcemeta::core::schema_resolver, - sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to reject the schema"; - } catch (const std::exception &) { - SUCCEED(); - } + EXPECT_THROW( + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler), + sourcemeta::core::SchemaError); } -TEST(Evaluator, compile_rejects_non_schema_root) { - const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON( - 1 - )JSON")}; +TEST(Evaluator, non_schema_root) { + const sourcemeta::core::JSON schema{sourcemeta::core::parse_json("1")}; - try { - sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, - sourcemeta::core::schema_resolver, - sourcemeta::blaze::default_schema_compiler); - FAIL() << "The compile function was expected to reject the schema"; - } catch (const std::exception &) { - SUCCEED(); - } + EXPECT_THROW( + sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, + sourcemeta::blaze::default_schema_compiler), + sourcemeta::core::SchemaError); } From f96a632cdd727725fb82487230edf126bd8fa3d3 Mon Sep 17 00:00:00 2001 From: Vaibhav mittal Date: Sat, 11 Apr 2026 02:19:41 +0000 Subject: [PATCH 11/11] test: drop non-schema root evaluator case Signed-off-by: Vaibhav mittal --- test/evaluator/evaluator_test.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/evaluator/evaluator_test.cc b/test/evaluator/evaluator_test.cc index de71f3630..b83ae76b0 100644 --- a/test/evaluator/evaluator_test.cc +++ b/test/evaluator/evaluator_test.cc @@ -341,13 +341,3 @@ TEST(Evaluator, invalid_items_type) { sourcemeta::blaze::default_schema_compiler), sourcemeta::core::SchemaError); } - -TEST(Evaluator, non_schema_root) { - const sourcemeta::core::JSON schema{sourcemeta::core::parse_json("1")}; - - EXPECT_THROW( - sourcemeta::blaze::compile(schema, sourcemeta::core::schema_walker, - sourcemeta::core::schema_resolver, - sourcemeta::blaze::default_schema_compiler), - sourcemeta::core::SchemaError); -}