diff --git a/src/evaluator/include/sourcemeta/jsontoolkit/evaluator_template.h b/src/evaluator/include/sourcemeta/jsontoolkit/evaluator_template.h index 2fe345f75..5b1228cb0 100644 --- a/src/evaluator/include/sourcemeta/jsontoolkit/evaluator_template.h +++ b/src/evaluator/include/sourcemeta/jsontoolkit/evaluator_template.h @@ -181,9 +181,6 @@ enum class SchemaCompilerTemplateIndex : std::uint8_t { }; #endif -// TODO: Do we really need "dynamic", "report", and "exhaustive" on -// non-applicators? - #define DEFINE_STEP_WITH_VALUE(category, name, type) \ struct SchemaCompiler##category##name { \ const Pointer relative_schema_location; \ @@ -192,7 +189,6 @@ enum class SchemaCompilerTemplateIndex : std::uint8_t { const std::string schema_resource; \ const bool dynamic; \ const bool report; \ - const bool exhaustive; \ const type value; \ }; @@ -204,7 +200,6 @@ enum class SchemaCompilerTemplateIndex : std::uint8_t { const std::string schema_resource; \ const bool dynamic; \ const bool report; \ - const bool exhaustive; \ const type value; \ const SchemaCompilerTemplate children; \ }; diff --git a/src/jsonschema/compile_helpers.h b/src/jsonschema/compile_helpers.h index 30054c6cc..e0d662566 100644 --- a/src/jsonschema/compile_helpers.h +++ b/src/jsonschema/compile_helpers.h @@ -28,7 +28,6 @@ auto make(const bool report, const SchemaCompilerContext &context, schema_context.base.recompose(), context.uses_dynamic_scopes, report, - context.mode != SchemaCompilerMode::FastValidation, value}; } @@ -50,7 +49,6 @@ auto make(const bool report, const SchemaCompilerContext &context, schema_context.base.recompose(), context.uses_dynamic_scopes, report, - context.mode != SchemaCompilerMode::FastValidation, std::move(value), std::move(children)}; } @@ -71,7 +69,6 @@ auto unroll(const SchemaCompilerDynamicContext &dynamic_context, std::get(step).schema_resource, std::get(step).dynamic, std::get(step).report, - std::get(step).exhaustive, std::get(step).value}; } diff --git a/src/jsonschema/default_compiler_draft4.h b/src/jsonschema/default_compiler_draft4.h index a8cebfbfc..df705beb7 100644 --- a/src/jsonschema/default_compiler_draft4.h +++ b/src/jsonschema/default_compiler_draft4.h @@ -524,8 +524,7 @@ auto compiler_draft4_applicator_properties_conditional_annotation( dynamic_context.base_instance_location.concat( type_step.relative_instance_location), type_step.keyword_location, type_step.schema_resource, - type_step.dynamic, type_step.report, type_step.exhaustive, - type_step.value}); + type_step.dynamic, type_step.report, type_step.value}); } else if (context.mode == SchemaCompilerMode::FastValidation && substeps.size() == 1 && std::holds_alternative( @@ -537,8 +536,7 @@ auto compiler_draft4_applicator_properties_conditional_annotation( dynamic_context.base_instance_location.concat( type_step.relative_instance_location), type_step.keyword_location, type_step.schema_resource, - type_step.dynamic, type_step.report, type_step.exhaustive, - type_step.value}); + type_step.dynamic, type_step.report, type_step.value}); } else if (context.mode == SchemaCompilerMode::FastValidation && substeps.size() == 1 && std::holds_alternative< diff --git a/test/evaluator/CMakeLists.txt b/test/evaluator/CMakeLists.txt index f9f17fb06..a4fdcc210 100644 --- a/test/evaluator/CMakeLists.txt +++ b/test/evaluator/CMakeLists.txt @@ -5,7 +5,6 @@ add_executable(sourcemeta_jsontoolkit_evaluator_unit evaluator_draft4_test.cc evaluator_draft6_test.cc evaluator_draft7_test.cc - evaluator_evaluate_test.cc evaluator_test.cc) noa_add_default_options(PRIVATE sourcemeta_jsontoolkit_evaluator_unit) target_link_libraries(sourcemeta_jsontoolkit_evaluator_unit diff --git a/test/evaluator/evaluator_evaluate_test.cc b/test/evaluator/evaluator_evaluate_test.cc deleted file mode 100644 index d07507ee3..000000000 --- a/test/evaluator/evaluator_evaluate_test.cc +++ /dev/null @@ -1,509 +0,0 @@ -#include - -#include -#include - -#include -#include -#include -#include - -TEST(JSONSchema_evaluator_evaluate, fast_step_defines_true) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{ - SchemaCompilerAssertionDefines{Pointer{}, Pointer{}, "#", "", true, true, - false, SchemaCompilerValueString{"foo"}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_defines_false) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{ - SchemaCompilerAssertionDefines{Pointer{}, Pointer{}, "#", "", true, true, - false, SchemaCompilerValueString{"bar"}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_fail) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{ - SchemaCompilerAssertionFail{Pointer{}, Pointer{}, "#", "", true, true, - false, SchemaCompilerValueNone{}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_type_true) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Object}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_type_false) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_or_empty) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{SchemaCompilerLogicalOr{ - Pointer{}, Pointer{}, "#", "", true, true, false, false, {}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_or_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{ - SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}, - SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Array}}}; - - const SchemaCompilerTemplate steps{SchemaCompilerLogicalOr{ - Pointer{}, Pointer{}, "#", "", true, true, false, false, children}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_and_empty) { - using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalAnd{Pointer{}, - Pointer{}, - "#", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - {}}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_and_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{ - SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}, - SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Array}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalAnd{Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueNone{}, children}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_properties_empty) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopProperties{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - children}}; - - const JSON instance{parse("{}")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_properties_single_true) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{"loop", "type"}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopProperties{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - children}}; - - const JSON instance{parse("{ \"foo\": 1 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_properties_single_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{"loop", "type"}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopProperties{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - children}}; - - const JSON instance{parse("{ \"foo\": true }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_properties_multi_true) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{"loop", "type"}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopProperties{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - children}}; - - const JSON instance{parse("{ \"foo\": 1, \"bar\": 2 }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_properties_multi_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{"loop", "type"}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopProperties{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueNone{}, - children}}; - - const JSON instance{parse("{ \"foo\": 1, \"bar\": true }")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_regex_true) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate steps{SchemaCompilerAssertionRegex{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueRegex{std::regex{"^a", std::regex::ECMAScript}, - "^a"}}}; - - const JSON instance{"abc"}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_regex_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate steps{SchemaCompilerAssertionRegex{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueRegex{std::regex{"^a", std::regex::ECMAScript}, - "^a"}}}; - - const JSON instance{"foo"}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_not_type_true) { - using namespace sourcemeta::jsontoolkit; - SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalNot{Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueNone{}, std::move(children)}}; - - const JSON instance{"foo"}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_step_not_type_false) { - using namespace sourcemeta::jsontoolkit; - SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueType{JSON::Type::Integer}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalNot{Pointer{}, Pointer{}, "#", "", true, true, false, - SchemaCompilerValueNone{}, std::move(children)}}; - - const JSON instance{5}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_empty) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{0}, - children}}; - - const JSON instance{parse("[]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_single_true) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{0}, - children}}; - - const JSON instance{parse("[ \"foo\" ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_single_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{0}, - children}}; - - const JSON instance{parse("[ 5 ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_multi_true) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{0}, - children}}; - - const JSON instance{parse("[ \"foo\", \"bar\", \"baz\" ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_multi_false) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{0}, - children}}; - - const JSON instance{parse("[ \"foo\", 4, \"baz\" ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_with_index_empty) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{2}, - children}}; - - const JSON instance{parse("[]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_with_index_less) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{2}, - children}}; - - const JSON instance{parse("[ 1, 2 ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_with_index_match) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{2}, - children}}; - - const JSON instance{parse("[ 1, 2, \"foo\", \"bar\" ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_TRUE(result); -} - -TEST(JSONSchema_evaluator_evaluate, fast_loop_items_with_index_no_match) { - using namespace sourcemeta::jsontoolkit; - - const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#/loop/type", "", true, true, false, - SchemaCompilerValueType{JSON::Type::String}}}; - - const SchemaCompilerTemplate steps{ - SchemaCompilerLoopItems{{"loop"}, - {}, - "#/loop", - "", - true, - true, - false, - SchemaCompilerValueUnsignedInteger{2}, - children}}; - - const JSON instance{parse("[ 1, 2, 3, \"foo\" ]")}; - const auto result{evaluate(steps, instance)}; - EXPECT_FALSE(result); -} diff --git a/test/jsonschema/jsonschema_compile_json_test.cc b/test/jsonschema/jsonschema_compile_json_test.cc index 112af8c0e..6bdd1ba66 100644 --- a/test/jsonschema/jsonschema_compile_json_test.cc +++ b/test/jsonschema/jsonschema_compile_json_test.cc @@ -7,7 +7,7 @@ TEST(JSONSchema_compile_json, defines_basic_root) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate steps{ SchemaCompilerAssertionDefines{Pointer{}, Pointer{}, "#", "", true, true, - false, SchemaCompilerValueString{"foo"}}}; + SchemaCompilerValueString{"foo"}}}; const JSON result{to_json(steps)}; const JSON expected{parse(R"EOF([ @@ -34,7 +34,7 @@ TEST(JSONSchema_compile_json, defines_basic_root) { TEST(JSONSchema_compile_json, defines_basic_nested) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate steps{SchemaCompilerAssertionDefines{ - Pointer{"foo", "bar"}, Pointer{}, "#/foo/bar", "", true, true, false, + Pointer{"foo", "bar"}, Pointer{}, "#/foo/bar", "", true, true, SchemaCompilerValueString{"foo"}}}; const JSON result{to_json(steps)}; @@ -61,9 +61,8 @@ TEST(JSONSchema_compile_json, defines_basic_nested) { TEST(JSONSchema_compile_json, fail_basic_root) { using namespace sourcemeta::jsontoolkit; - const SchemaCompilerTemplate steps{ - SchemaCompilerAssertionFail{Pointer{}, Pointer{}, "#", "", true, true, - false, SchemaCompilerValueNone{}}}; + const SchemaCompilerTemplate steps{SchemaCompilerAssertionFail{ + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueNone{}}}; const JSON result{to_json(steps)}; const JSON expected{parse(R"EOF([ @@ -86,7 +85,7 @@ TEST(JSONSchema_compile_json, fail_basic_root) { TEST(JSONSchema_compile_json, type_basic_root) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate steps{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::String}}}; const JSON result{to_json(steps)}; @@ -114,7 +113,7 @@ TEST(JSONSchema_compile_json, type_basic_root) { TEST(JSONSchema_compile_json, or_empty) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate steps{SchemaCompilerLogicalOr{ - Pointer{}, Pointer{}, "#", "", true, true, false, false, {}}}; + Pointer{}, Pointer{}, "#", "", true, true, false, {}}}; const JSON result{to_json(steps)}; const JSON expected{parse(R"EOF([ @@ -143,11 +142,11 @@ TEST(JSONSchema_compile_json, or_single_child) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::String}}}; const SchemaCompilerTemplate steps{SchemaCompilerLogicalOr{ - Pointer{}, Pointer{}, "#", "", true, true, false, false, children}}; + Pointer{}, Pointer{}, "#", "", true, true, false, children}}; const JSON result{to_json(steps)}; const JSON expected{parse(R"EOF([ @@ -193,14 +192,14 @@ TEST(JSONSchema_compile_json, or_multiple_children) { const SchemaCompilerTemplate children{ SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::String}}, SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::Array}}}; const SchemaCompilerTemplate steps{SchemaCompilerLogicalOr{ - Pointer{}, Pointer{}, "#", "", true, true, false, false, children}}; + Pointer{}, Pointer{}, "#", "", true, true, false, children}}; const JSON result{to_json(steps)}; const JSON expected{parse(R"EOF([ @@ -265,7 +264,6 @@ TEST(JSONSchema_compile_json, and_empty) { "", true, true, - false, SchemaCompilerValueNone{}, {}}}; @@ -292,11 +290,11 @@ TEST(JSONSchema_compile_json, and_single_child) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate children{SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::String}}}; const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalAnd{Pointer{}, Pointer{}, "#", "", true, true, false, + SchemaCompilerLogicalAnd{Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueNone{}, children}}; const JSON result{to_json(steps)}; @@ -339,14 +337,14 @@ TEST(JSONSchema_compile_json, and_multiple_children) { const SchemaCompilerTemplate children{ SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::String}}, SchemaCompilerAssertionTypeStrict{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueType{JSON::Type::Array}}}; const SchemaCompilerTemplate steps{ - SchemaCompilerLogicalAnd{Pointer{}, Pointer{}, "#", "", true, true, false, + SchemaCompilerLogicalAnd{Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueNone{}, children}}; const JSON result{to_json(steps)}; @@ -402,7 +400,7 @@ TEST(JSONSchema_compile_json, and_multiple_children) { TEST(JSONSchema_compile_json, regex_basic) { using namespace sourcemeta::jsontoolkit; const SchemaCompilerTemplate steps{SchemaCompilerAssertionRegex{ - Pointer{}, Pointer{}, "#", "", true, true, false, + Pointer{}, Pointer{}, "#", "", true, true, SchemaCompilerValueRegex{std::regex{"^a", std::regex::ECMAScript}, "^a"}}};