diff --git a/src/core/jsonschema/frame.cc b/src/core/jsonschema/frame.cc index cd307ec6d..06a60d165 100644 --- a/src/core/jsonschema/frame.cc +++ b/src/core/jsonschema/frame.cc @@ -1037,7 +1037,7 @@ auto find_adjacent_dependencies( } // Static - case SchemaKeywordType::ApplicatorElementsInPlaceInline: + case SchemaKeywordType::ApplicatorElementsInPlace: for (std::size_t index = 0; index < property.second.size(); index++) { find_adjacent_dependencies( current, schema, frame, walker, resolver, keywords, root, @@ -1048,7 +1048,7 @@ auto find_adjacent_dependencies( break; // Dynamic - case SchemaKeywordType::ApplicatorElementsInPlace: + case SchemaKeywordType::ApplicatorElementsInPlaceSome: if (property.second.is_array()) { for (std::size_t index = 0; index < property.second.size(); index++) { find_adjacent_dependencies( @@ -1062,7 +1062,7 @@ auto find_adjacent_dependencies( [[fallthrough]]; case SchemaKeywordType::ApplicatorValueTraverseParent: [[fallthrough]]; - case SchemaKeywordType::ApplicatorValueInPlace: + case SchemaKeywordType::ApplicatorValueInPlaceMaybe: if (is_schema(property.second)) { find_adjacent_dependencies( current, schema, frame, walker, resolver, keywords, root, @@ -1084,7 +1084,7 @@ auto find_adjacent_dependencies( } break; - case SchemaKeywordType::ApplicatorMembersInPlace: + case SchemaKeywordType::ApplicatorMembersInPlaceSome: if (property.second.is_object()) { for (const auto &pair : property.second.as_object()) { find_adjacent_dependencies( diff --git a/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h b/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h index 1b29e0360..b2e7e43e8 100644 --- a/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h +++ b/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h @@ -87,8 +87,8 @@ enum class SchemaKeywordType : std::uint8_t { ApplicatorMembersTraversePropertyRegex, /// The JSON Schema keyword is an applicator that potentially /// takes a JSON Schema definition as an argument - /// The instance traverses to any property - ApplicatorValueTraverseAnyProperty, + /// The instance traverses to some of the properties + ApplicatorValueTraverseSomeProperty, /// The JSON Schema keyword is an applicator that potentially /// takes a JSON Schema definition as an argument /// The instance traverses to any property key @@ -99,6 +99,10 @@ enum class SchemaKeywordType : std::uint8_t { ApplicatorValueTraverseAnyItem, /// The JSON Schema keyword is an applicator that potentially /// takes a JSON Schema definition as an argument + /// The instance traverses to some of the items + ApplicatorValueTraverseSomeItem, + /// The JSON Schema keyword is an applicator that potentially + /// takes a JSON Schema definition as an argument /// The instance traverses back to the parent ApplicatorValueTraverseParent, /// The JSON Schema keyword is an applicator that potentially @@ -120,23 +124,23 @@ enum class SchemaKeywordType : std::uint8_t { /// takes an object as argument, whose values are potentially /// JSON Schema definitions without affecting the instance location. /// The instance does not traverse - ApplicatorMembersInPlace, + ApplicatorMembersInPlaceSome, /// The JSON Schema keyword is an applicator that potentially /// takes an array of potentially JSON Schema definitions - /// as an argument without affecting the instance location + /// as an argument without affecting the instance location. /// The instance does not traverse ApplicatorElementsInPlace, /// The JSON Schema keyword is an applicator that potentially + /// takes an array of potentially JSON Schema definitions + /// as an argument without affecting the instance location + /// The instance does not traverse, and only some of the + /// elements apply. + ApplicatorElementsInPlaceSome, + /// The JSON Schema keyword is an applicator that potentially /// takes a JSON Schema definition as an argument without affecting the /// instance location. - /// The instance does not traverse - ApplicatorValueInPlace, - /// The JSON Schema keyword is an applicator that potentially - /// takes an array of potentially JSON Schema definitions - /// as an argument without affecting the instance location and that can be - /// statically inlined. - /// The instance does not traverse - ApplicatorElementsInPlaceInline, + /// The instance does not traverse, and only applies some of the times. + ApplicatorValueInPlaceMaybe, /// The JSON Schema keyword is an applicator that potentially /// takes a JSON Schema definition as an argument but its evaluation follows /// special rules. diff --git a/src/core/jsonschema/official_walker.cc b/src/core/jsonschema/official_walker.cc index 556476601..d6469d7ec 100644 --- a/src/core/jsonschema/official_walker.cc +++ b/src/core/jsonschema/official_walker.cc @@ -36,16 +36,16 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTPS_BASE "2020-12/vocab/core", "$dynamicRef", Reference) WALK(HTTPS_BASE "2020-12/vocab/core", "$dynamicAnchor", Other) WALK(HTTPS_BASE "2020-12/vocab/applicator", "oneOf", - ApplicatorElementsInPlace) + ApplicatorElementsInPlaceSome) WALK(HTTPS_BASE "2020-12/vocab/applicator", "anyOf", - ApplicatorElementsInPlace) + ApplicatorElementsInPlaceSome) WALK(HTTPS_BASE "2020-12/vocab/applicator", "allOf", - ApplicatorElementsInPlaceInline) - WALK(HTTPS_BASE "2020-12/vocab/applicator", "if", ApplicatorValueInPlace) - WALK(HTTPS_BASE "2020-12/vocab/applicator", "then", ApplicatorValueInPlace, - "if") - WALK(HTTPS_BASE "2020-12/vocab/applicator", "else", ApplicatorValueInPlace, - "if") + ApplicatorElementsInPlace) + WALK(HTTPS_BASE "2020-12/vocab/applicator", "if", ApplicatorValueInPlaceMaybe) + WALK(HTTPS_BASE "2020-12/vocab/applicator", "then", + ApplicatorValueInPlaceMaybe, "if") + WALK(HTTPS_BASE "2020-12/vocab/applicator", "else", + ApplicatorValueInPlaceMaybe, "if") WALK(HTTPS_BASE "2020-12/vocab/applicator", "not", ApplicatorValueInPlaceOther) // For the purpose of compiler optimizations @@ -53,19 +53,19 @@ auto sourcemeta::core::schema_official_walker( ApplicatorMembersTraversePropertyStatic, HTTPS_BASE "2020-12/vocab/validation", "required") WALK(HTTPS_BASE "2020-12/vocab/applicator", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties", "patternProperties") + ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK(HTTPS_BASE "2020-12/vocab/applicator", "patternProperties", ApplicatorMembersTraversePropertyRegex) WALK(HTTPS_BASE "2020-12/vocab/applicator", "propertyNames", ApplicatorValueTraverseAnyPropertyKey) WALK(HTTPS_BASE "2020-12/vocab/applicator", "dependentSchemas", - ApplicatorMembersInPlace) + ApplicatorMembersInPlaceSome) WALK_MAYBE_DEPENDENT(HTTPS_BASE "2020-12/vocab/applicator", "contains", ApplicatorValueTraverseAnyItem, HTTPS_BASE "2020-12/vocab/validation", "minContains", "maxContains") WALK(HTTPS_BASE "2020-12/vocab/applicator", "items", - ApplicatorValueTraverseAnyItem, "prefixItems") + ApplicatorValueTraverseSomeItem, "prefixItems") WALK(HTTPS_BASE "2020-12/vocab/applicator", "prefixItems", ApplicatorElementsTraverseItem) // For the purpose of compiler optimizations @@ -98,12 +98,13 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTPS_BASE "2020-12/vocab/meta-data", "default", Annotation) WALK(HTTPS_BASE "2020-12/vocab/meta-data", "deprecated", Annotation) WALK(HTTPS_BASE "2020-12/vocab/format-annotation", "format", Annotation) - WALK_MAYBE_DEPENDENT( - HTTPS_BASE "2020-12/vocab/unevaluated", "unevaluatedProperties", - ApplicatorValueTraverseAnyProperty, HTTPS_BASE "2020-12/vocab/applicator", - "properties", "patternProperties", "additionalProperties") WALK_MAYBE_DEPENDENT(HTTPS_BASE "2020-12/vocab/unevaluated", - "unevaluatedItems", ApplicatorValueTraverseAnyItem, + "unevaluatedProperties", + ApplicatorValueTraverseSomeProperty, + HTTPS_BASE "2020-12/vocab/applicator", "properties", + "patternProperties", "additionalProperties") + WALK_MAYBE_DEPENDENT(HTTPS_BASE "2020-12/vocab/unevaluated", + "unevaluatedItems", ApplicatorValueTraverseSomeItem, HTTPS_BASE "2020-12/vocab/applicator", "prefixItems", "items", "contains") WALK(HTTPS_BASE "2020-12/vocab/content", "contentSchema", @@ -126,16 +127,16 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTPS_BASE "2019-09/vocab/core", "$recursiveRef", Reference) WALK(HTTPS_BASE "2019-09/vocab/core", "$recursiveAnchor", Other) WALK(HTTPS_BASE "2019-09/vocab/applicator", "allOf", - ApplicatorElementsInPlaceInline) - WALK(HTTPS_BASE "2019-09/vocab/applicator", "anyOf", ApplicatorElementsInPlace) + WALK(HTTPS_BASE "2019-09/vocab/applicator", "anyOf", + ApplicatorElementsInPlaceSome) WALK(HTTPS_BASE "2019-09/vocab/applicator", "oneOf", - ApplicatorElementsInPlace) - WALK(HTTPS_BASE "2019-09/vocab/applicator", "if", ApplicatorValueInPlace) - WALK(HTTPS_BASE "2019-09/vocab/applicator", "then", ApplicatorValueInPlace, - "if") - WALK(HTTPS_BASE "2019-09/vocab/applicator", "else", ApplicatorValueInPlace, - "if") + ApplicatorElementsInPlaceSome) + WALK(HTTPS_BASE "2019-09/vocab/applicator", "if", ApplicatorValueInPlaceMaybe) + WALK(HTTPS_BASE "2019-09/vocab/applicator", "then", + ApplicatorValueInPlaceMaybe, "if") + WALK(HTTPS_BASE "2019-09/vocab/applicator", "else", + ApplicatorValueInPlaceMaybe, "if") WALK(HTTPS_BASE "2019-09/vocab/applicator", "not", ApplicatorValueInPlaceOther) // For the purpose of compiler optimizations @@ -145,16 +146,16 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTPS_BASE "2019-09/vocab/applicator", "patternProperties", ApplicatorMembersTraversePropertyRegex) WALK(HTTPS_BASE "2019-09/vocab/applicator", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties", "patternProperties") + ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK(HTTPS_BASE "2019-09/vocab/applicator", "propertyNames", ApplicatorValueTraverseAnyPropertyKey) WALK(HTTPS_BASE "2019-09/vocab/applicator", "dependentSchemas", - ApplicatorMembersInPlace) + ApplicatorMembersInPlaceSome) WALK(HTTPS_BASE "2019-09/vocab/applicator", "unevaluatedProperties", - ApplicatorValueTraverseAnyProperty, "properties", "patternProperties", + ApplicatorValueTraverseSomeProperty, "properties", "patternProperties", "additionalProperties") WALK(HTTPS_BASE "2019-09/vocab/applicator", "unevaluatedItems", - ApplicatorValueTraverseAnyItem, "items", "additionalItems") + ApplicatorValueTraverseSomeItem, "items", "additionalItems") WALK(HTTPS_BASE "2019-09/vocab/applicator", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem) WALK_MAYBE_DEPENDENT(HTTPS_BASE "2019-09/vocab/applicator", "contains", @@ -162,7 +163,7 @@ auto sourcemeta::core::schema_official_walker( HTTPS_BASE "2019-09/vocab/validation", "minContains", "maxContains") WALK(HTTPS_BASE "2019-09/vocab/applicator", "additionalItems", - ApplicatorValueTraverseAnyItem, "items") + ApplicatorValueTraverseSomeItem, "items") // For the purpose of compiler optimizations WALK_MAYBE_DEPENDENT(HTTPS_BASE "2019-09/vocab/validation", "type", Assertion, HTTPS_BASE "2019-09/vocab/applicator", "properties") @@ -244,7 +245,7 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "additionalItems", ApplicatorValueTraverseAnyItem, "items") + "additionalItems", ApplicatorValueTraverseSomeItem, "items") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", "maxItems", Assertion, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", @@ -266,24 +267,24 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", "patternProperties", ApplicatorMembersTraversePropertyRegex, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "additionalProperties", ApplicatorValueTraverseAnyProperty, + "additionalProperties", ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "dependencies", ApplicatorMembersInPlace, "$ref") + "dependencies", ApplicatorMembersInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", "propertyNames", ApplicatorValueTraverseAnyPropertyKey, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "if", ApplicatorValueInPlace, "$ref") + "if", ApplicatorValueInPlaceMaybe, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "then", ApplicatorValueInPlace, "if") + "then", ApplicatorValueInPlaceMaybe, "if") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "else", ApplicatorValueInPlace, "if") + "else", ApplicatorValueInPlaceMaybe, "if") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "allOf", ApplicatorElementsInPlaceInline, "$ref") + "allOf", ApplicatorElementsInPlace, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "anyOf", ApplicatorElementsInPlace, "$ref") + "anyOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", - "oneOf", ApplicatorElementsInPlace, "$ref") + "oneOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", "not", ApplicatorValueInPlaceOther, "$ref") WALK_ANY(HTTP_BASE "draft-07/schema#", HTTP_BASE "draft-07/hyper-schema#", @@ -362,7 +363,7 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "additionalItems", ApplicatorValueTraverseAnyItem, "items") + "additionalItems", ApplicatorValueTraverseSomeItem, "items") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", "maxItems", Assertion, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", @@ -384,18 +385,18 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", "patternProperties", ApplicatorMembersTraversePropertyRegex, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "additionalProperties", ApplicatorValueTraverseAnyProperty, + "additionalProperties", ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "dependencies", ApplicatorMembersInPlace, "$ref") + "dependencies", ApplicatorMembersInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", "propertyNames", ApplicatorValueTraverseAnyPropertyKey, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "allOf", ApplicatorElementsInPlaceInline, "$ref") + "allOf", ApplicatorElementsInPlace, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "anyOf", ApplicatorElementsInPlace, "$ref") + "anyOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", - "oneOf", ApplicatorElementsInPlace, "$ref") + "oneOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", "not", ApplicatorValueInPlaceOther, "$ref") WALK_ANY(HTTP_BASE "draft-06/schema#", HTTP_BASE "draft-06/hyper-schema#", @@ -467,7 +468,7 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "additionalItems", ApplicatorValueTraverseAnyItem, "items") + "additionalItems", ApplicatorValueTraverseSomeItem, "items") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", "maxItems", Assertion, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", @@ -487,16 +488,16 @@ auto sourcemeta::core::schema_official_walker( WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", "patternProperties", ApplicatorMembersTraversePropertyRegex, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "additionalProperties", ApplicatorValueTraverseAnyProperty, + "additionalProperties", ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "dependencies", ApplicatorMembersInPlace, "$ref") + "dependencies", ApplicatorMembersInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "allOf", ApplicatorElementsInPlaceInline, "$ref") + "allOf", ApplicatorElementsInPlace, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "anyOf", ApplicatorElementsInPlace, "$ref") + "anyOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", - "oneOf", ApplicatorElementsInPlace, "$ref") + "oneOf", ApplicatorElementsInPlaceSome, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", "not", ApplicatorValueInPlaceOther, "$ref") WALK_ANY(HTTP_BASE "draft-04/schema#", HTTP_BASE "draft-04/hyper-schema#", @@ -530,25 +531,26 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-03/schema#", "$ref", Reference) WALK(HTTP_BASE "draft-03/schema#", "extends", ApplicatorValueOrElementsInPlace, "$ref") - WALK(HTTP_BASE "draft-03/schema#", "type", ApplicatorElementsInPlace, "$ref") - WALK(HTTP_BASE "draft-03/schema#", "disallow", ApplicatorElementsInPlace, + WALK(HTTP_BASE "draft-03/schema#", "type", ApplicatorElementsInPlaceSome, + "$ref") + WALK(HTTP_BASE "draft-03/schema#", "disallow", ApplicatorElementsInPlaceSome, "$ref") WALK(HTTP_BASE "draft-03/schema#", "properties", ApplicatorMembersTraversePropertyStatic, "$ref") WALK(HTTP_BASE "draft-03/schema#", "patternProperties", ApplicatorMembersTraversePropertyRegex, "$ref") WALK(HTTP_BASE "draft-03/schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties", "patternProperties") + ApplicatorValueTraverseSomeProperty, "properties", "patternProperties") WALK(HTTP_BASE "draft-03/schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem, "$ref") WALK(HTTP_BASE "draft-03/schema#", "additionalItems", - ApplicatorValueTraverseAnyItem, "items") + ApplicatorValueTraverseSomeItem, "items") WALK(HTTP_BASE "draft-03/schema#", "minItems", Assertion, "$ref") WALK(HTTP_BASE "draft-03/schema#", "maxItems", Assertion, "$ref") WALK(HTTP_BASE "draft-03/schema#", "uniqueItems", Assertion, "$ref") WALK(HTTP_BASE "draft-03/schema#", "required", Assertion, "$ref") - WALK(HTTP_BASE "draft-03/schema#", "dependencies", ApplicatorMembersInPlace, - "$ref") + WALK(HTTP_BASE "draft-03/schema#", "dependencies", + ApplicatorMembersInPlaceSome, "$ref") WALK(HTTP_BASE "draft-03/schema#", "enum", Assertion, "$ref") WALK(HTTP_BASE "draft-03/schema#", "pattern", Assertion, "$ref") WALK(HTTP_BASE "draft-03/schema#", "minLength", Assertion, "$ref") @@ -582,8 +584,8 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-02/schema#", "properties", ApplicatorMembersTraversePropertyStatic) WALK(HTTP_BASE "draft-02/schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") - WALK(HTTP_BASE "draft-02/schema#", "type", ApplicatorElementsInPlace) + ApplicatorValueTraverseSomeProperty, "properties") + WALK(HTTP_BASE "draft-02/schema#", "type", ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-02/schema#", "enum", Assertion) WALK(HTTP_BASE "draft-02/schema#", "maximum", Assertion) WALK(HTTP_BASE "draft-02/schema#", "minimum", Assertion) @@ -609,7 +611,8 @@ auto sourcemeta::core::schema_official_walker( ApplicatorValueTraverseParent) WALK(HTTP_BASE "draft-02/hyper-schema#", "targetSchema", ApplicatorValueInPlaceOther) - WALK(HTTP_BASE "draft-02/hyper-schema#", "type", ApplicatorElementsInPlace) + WALK(HTTP_BASE "draft-02/hyper-schema#", "type", + ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-02/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem) WALK(HTTP_BASE "draft-02/hyper-schema#", "properties", @@ -617,7 +620,7 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-02/hyper-schema#", "extends", ApplicatorValueOrElementsInPlace) WALK(HTTP_BASE "draft-02/hyper-schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") + ApplicatorValueTraverseSomeProperty, "properties") // Draft1 WALK(HTTP_BASE "draft-01/schema#", "$schema", Other) @@ -628,8 +631,8 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-01/schema#", "properties", ApplicatorMembersTraversePropertyStatic) WALK(HTTP_BASE "draft-01/schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") - WALK(HTTP_BASE "draft-01/schema#", "type", ApplicatorElementsInPlace) + ApplicatorValueTraverseSomeProperty, "properties") + WALK(HTTP_BASE "draft-01/schema#", "type", ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-01/schema#", "enum", Assertion) WALK(HTTP_BASE "draft-01/schema#", "maximum", Assertion) WALK(HTTP_BASE "draft-01/schema#", "minimum", Assertion) @@ -651,7 +654,8 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-01/schema#", "contentEncoding", Comment) WALK(HTTP_BASE "draft-01/schema#", "optional", Assertion) WALK(HTTP_BASE "draft-01/schema#", "maxDecimal", Assertion) - WALK(HTTP_BASE "draft-01/hyper-schema#", "type", ApplicatorElementsInPlace) + WALK(HTTP_BASE "draft-01/hyper-schema#", "type", + ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-01/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem) WALK(HTTP_BASE "draft-01/hyper-schema#", "properties", @@ -661,7 +665,7 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-01/hyper-schema#", "requires", ApplicatorValueTraverseParent) WALK(HTTP_BASE "draft-01/hyper-schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") + ApplicatorValueTraverseSomeProperty, "properties") // Draft0 WALK(HTTP_BASE "draft-00/schema#", "$schema", Other) @@ -672,8 +676,8 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-00/schema#", "properties", ApplicatorMembersTraversePropertyStatic) WALK(HTTP_BASE "draft-00/schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") - WALK(HTTP_BASE "draft-00/schema#", "type", ApplicatorElementsInPlace) + ApplicatorValueTraverseSomeProperty, "properties") + WALK(HTTP_BASE "draft-00/schema#", "type", ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-00/schema#", "enum", Assertion) WALK(HTTP_BASE "draft-00/schema#", "maximum", Assertion) WALK(HTTP_BASE "draft-00/schema#", "minimum", Assertion) @@ -695,7 +699,8 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-00/schema#", "contentEncoding", Comment) WALK(HTTP_BASE "draft-00/schema#", "optional", Assertion) WALK(HTTP_BASE "draft-00/schema#", "maxDecimal", Assertion) - WALK(HTTP_BASE "draft-00/hyper-schema#", "type", ApplicatorElementsInPlace) + WALK(HTTP_BASE "draft-00/hyper-schema#", "type", + ApplicatorElementsInPlaceSome) WALK(HTTP_BASE "draft-00/hyper-schema#", "items", ApplicatorValueOrElementsTraverseAnyItemOrItem) WALK(HTTP_BASE "draft-00/hyper-schema#", "properties", @@ -705,7 +710,7 @@ auto sourcemeta::core::schema_official_walker( WALK(HTTP_BASE "draft-00/hyper-schema#", "requires", ApplicatorValueTraverseParent) WALK(HTTP_BASE "draft-00/hyper-schema#", "additionalProperties", - ApplicatorValueTraverseAnyProperty, "properties") + ApplicatorValueTraverseSomeProperty, "properties") #undef HTTP_BASE #undef WALK #undef WALK_ANY diff --git a/src/core/jsonschema/walker.cc b/src/core/jsonschema/walker.cc index 160d4f0af..8f54c8d0c 100644 --- a/src/core/jsonschema/walker.cc +++ b/src/core/jsonschema/walker.cc @@ -52,14 +52,17 @@ auto walk(const std::optional &parent, for (auto &pair : subschema.as_object()) { switch (walker(pair.first, vocabularies).type) { case sourcemeta::core::SchemaKeywordType:: - ApplicatorValueTraverseAnyProperty: { + ApplicatorValueTraverseSomeProperty: { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); auto new_instance_location{instance_location}; + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Conditional{}); new_instance_location.emplace_back( sourcemeta::core::PointerTemplate::Wildcard::Property); walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Wildcard::Property}, + {sourcemeta::core::PointerTemplate::Conditional{}, + sourcemeta::core::PointerTemplate::Wildcard::Property}, subschemas, pair.second, walker, resolver, new_dialect, type, level + 1, orphan); } break; @@ -90,6 +93,22 @@ auto walk(const std::optional &parent, orphan); } break; + case sourcemeta::core::SchemaKeywordType:: + ApplicatorValueTraverseSomeItem: { + sourcemeta::core::Pointer new_pointer{pointer}; + new_pointer.emplace_back(pair.first); + auto new_instance_location{instance_location}; + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Conditional{}); + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Wildcard::Item); + walk(pointer, new_pointer, new_instance_location, + {sourcemeta::core::PointerTemplate::Conditional{}, + sourcemeta::core::PointerTemplate::Wildcard::Item}, + subschemas, pair.second, walker, resolver, new_dialect, type, + level + 1, orphan); + } break; + case sourcemeta::core::SchemaKeywordType::ApplicatorValueTraverseParent: { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); @@ -100,9 +119,7 @@ auto walk(const std::optional &parent, orphan); } break; - case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlaceOther: - [[fallthrough]]; - case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlace: { + case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlaceOther: { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); walk(pointer, new_pointer, instance_location, {}, subschemas, @@ -110,6 +127,18 @@ auto walk(const std::optional &parent, orphan); } break; + case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlaceMaybe: { + sourcemeta::core::Pointer new_pointer{pointer}; + new_pointer.emplace_back(pair.first); + auto new_instance_location{instance_location}; + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Conditional{}); + walk(pointer, new_pointer, new_instance_location, + {sourcemeta::core::PointerTemplate::Conditional{}}, subschemas, + pair.second, walker, resolver, new_dialect, type, level + 1, + orphan); + } break; + case sourcemeta::core::SchemaKeywordType::ApplicatorElementsTraverseItem: if (pair.second.is_array()) { for (std::size_t index = 0; index < pair.second.size(); index++) { @@ -126,8 +155,6 @@ auto walk(const std::optional &parent, break; - case sourcemeta::core::SchemaKeywordType::ApplicatorElementsInPlaceInline: - [[fallthrough]]; case sourcemeta::core::SchemaKeywordType::ApplicatorElementsInPlace: if (pair.second.is_array()) { for (std::size_t index = 0; index < pair.second.size(); index++) { @@ -142,6 +169,24 @@ auto walk(const std::optional &parent, break; + case sourcemeta::core::SchemaKeywordType::ApplicatorElementsInPlaceSome: + if (pair.second.is_array()) { + for (std::size_t index = 0; index < pair.second.size(); index++) { + sourcemeta::core::Pointer new_pointer{pointer}; + new_pointer.emplace_back(pair.first); + new_pointer.emplace_back(index); + auto new_instance_location{instance_location}; + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Conditional{}); + walk(pointer, new_pointer, new_instance_location, + {sourcemeta::core::PointerTemplate::Conditional{}}, subschemas, + pair.second.at(index), walker, resolver, new_dialect, type, + level + 1, orphan); + } + } + + break; + case sourcemeta::core::SchemaKeywordType:: ApplicatorMembersTraversePropertyStatic: if (pair.second.is_object()) { @@ -176,13 +221,17 @@ auto walk(const std::optional &parent, break; - case sourcemeta::core::SchemaKeywordType::ApplicatorMembersInPlace: + case sourcemeta::core::SchemaKeywordType::ApplicatorMembersInPlaceSome: if (pair.second.is_object()) { for (auto &subpair : pair.second.as_object()) { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(subpair.first); - walk(pointer, new_pointer, instance_location, {}, subschemas, + auto new_instance_location{instance_location}; + new_instance_location.emplace_back( + sourcemeta::core::PointerTemplate::Conditional{}); + walk(pointer, new_pointer, new_instance_location, + {sourcemeta::core::PointerTemplate::Conditional{}}, subschemas, subpair.second, walker, resolver, new_dialect, type, level + 1, orphan); } diff --git a/test/jsonschema/jsonschema_official_walker_2019_09_test.cc b/test/jsonschema/jsonschema_official_walker_2019_09_test.cc index c4bcdf742..4c4b46608 100644 --- a/test/jsonschema/jsonschema_official_walker_2019_09_test.cc +++ b/test/jsonschema/jsonschema_official_walker_2019_09_test.cc @@ -132,7 +132,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_allOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("allOf", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceInline); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -143,7 +143,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_anyOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("anyOf", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -154,7 +154,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_oneOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("oneOf", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -176,7 +176,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_if) { using namespace sourcemeta::core; const auto result{ schema_official_walker("if", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -187,7 +187,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_then) { using namespace sourcemeta::core; const auto result{ schema_official_walker("then", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -199,7 +199,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_else) { using namespace sourcemeta::core; const auto result{ schema_official_walker("else", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -211,7 +211,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_dependentSchemas) { using namespace sourcemeta::core; const auto result{schema_official_walker("dependentSchemas", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -234,7 +234,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_additionalItems) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalItems", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -299,7 +299,8 @@ TEST(JSONSchema_official_walker_2019_09, applicator_additionalProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalProperties", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -323,7 +324,7 @@ TEST(JSONSchema_official_walker_2019_09, applicator_unevaluatedItems) { using namespace sourcemeta::core; const auto result{schema_official_walker("unevaluatedItems", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -335,7 +336,8 @@ TEST(JSONSchema_official_walker_2019_09, applicator_unevaluatedProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("unevaluatedProperties", VOCABULARIES_2019_09_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2019-09/vocab/applicator"); @@ -1546,11 +1548,13 @@ TEST(JSONSchema_official_walker_2019_09, instance_locations) { // Applicator vocabulary (any) EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 1, "/allOf/0", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 2, "/allOf/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 3, "/anyOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 4, "/oneOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 5, "/if", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 6, "/then", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 7, "/else", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 3, "/anyOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 4, "/oneOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 5, "/if", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 6, "/then", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 7, "/else", "", "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 8, "/not", "", "", ""); // Applicator vocabulary (object) @@ -1559,15 +1563,15 @@ TEST(JSONSchema_official_walker_2019_09, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 10, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 11, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 12, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 13, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 14, "/dependentSchemas/foo", "", - "", ""); + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 15, "/dependentSchemas/bar", "", - "", ""); + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 16, "/propertyNames", "", "/~K~", "/~K~"); @@ -1575,7 +1579,7 @@ TEST(JSONSchema_official_walker_2019_09, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 17, "/contains", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 18, "/additionalItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 19, "/items", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 20, "/items/items/0", "/items", @@ -1585,9 +1589,9 @@ TEST(JSONSchema_official_walker_2019_09, instance_locations) { // Unevaluated applicators EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 22, "/unevaluatedProperties", - "", "/~P~", "/~P~"); + "", "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 23, "/unevaluatedItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); // Content vocabulary EXPECT_OFFICIAL_WALKER_ENTRY_2019_09(entries, 24, "/contentSchema", "", "", @@ -1634,5 +1638,5 @@ TEST(JSONSchema_official_walker_2019_09, definitions_subschemas) { entries, 2, "/$defs/foo/properties/bar", "/$defs/foo", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_2019_09_ORPHAN( entries, 3, "/$defs/foo/properties/bar/additionalProperties", - "/$defs/foo/properties/bar", "/bar/~P~", "/~P~"); + "/$defs/foo/properties/bar", "/bar/~?~/~P~", "/~?~/~P~"); } diff --git a/test/jsonschema/jsonschema_official_walker_2020_12_test.cc b/test/jsonschema/jsonschema_official_walker_2020_12_test.cc index 3b77905db..eef411851 100644 --- a/test/jsonschema/jsonschema_official_walker_2020_12_test.cc +++ b/test/jsonschema/jsonschema_official_walker_2020_12_test.cc @@ -140,7 +140,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_allOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("allOf", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceInline); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -151,7 +151,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_anyOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("anyOf", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -162,7 +162,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_oneOf) { using namespace sourcemeta::core; const auto result{ schema_official_walker("oneOf", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -184,7 +184,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_if) { using namespace sourcemeta::core; const auto result{ schema_official_walker("if", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -195,7 +195,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_then) { using namespace sourcemeta::core; const auto result{ schema_official_walker("then", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -207,7 +207,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_else) { using namespace sourcemeta::core; const auto result{ schema_official_walker("else", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -219,7 +219,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_dependentSchemas) { using namespace sourcemeta::core; const auto result{schema_official_walker("dependentSchemas", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -241,7 +241,7 @@ TEST(JSONSchema_official_walker_2020_12, applicator_items) { using namespace sourcemeta::core; const auto result{ schema_official_walker("items", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -306,7 +306,8 @@ TEST(JSONSchema_official_walker_2020_12, applicator_additionalProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalProperties", VOCABULARIES_2020_12_APPLICATOR)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/applicator"); @@ -330,7 +331,7 @@ TEST(JSONSchema_official_walker_2020_12, unevaluated_unevaluatedItems_only) { using namespace sourcemeta::core; const auto result{schema_official_walker("unevaluatedItems", VOCABULARIES_2020_12_UNEVALUATED)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/unevaluated"); @@ -348,7 +349,7 @@ TEST(JSONSchema_official_walker_2020_12, VOCABULARIES_2020_12_APPLICATOR.cend(), std::inserter(vocabularies, vocabularies.end())); const auto result{schema_official_walker("unevaluatedItems", vocabularies)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/unevaluated"); @@ -361,7 +362,8 @@ TEST(JSONSchema_official_walker_2020_12, using namespace sourcemeta::core; const auto result{schema_official_walker("unevaluatedProperties", VOCABULARIES_2020_12_UNEVALUATED)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/unevaluated"); @@ -380,7 +382,8 @@ TEST(JSONSchema_official_walker_2020_12, std::inserter(vocabularies, vocabularies.end())); const auto result{ schema_official_walker("unevaluatedProperties", vocabularies)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "https://json-schema.org/draft/2020-12/vocab/unevaluated"); @@ -1622,11 +1625,13 @@ TEST(JSONSchema_official_walker_2020_12, instance_locations) { // Applicator vocabulary (any) EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 1, "/allOf/0", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 2, "/allOf/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 3, "/anyOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 4, "/oneOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 5, "/if", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 6, "/then", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 7, "/else", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 3, "/anyOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 4, "/oneOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 5, "/if", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 6, "/then", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 7, "/else", "", "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 8, "/not", "", "", ""); // Applicator vocabulary (object) @@ -1635,23 +1640,23 @@ TEST(JSONSchema_official_walker_2020_12, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 10, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 11, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 12, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 13, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 14, "/dependentSchemas/foo", "", - "", ""); + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 15, "/dependentSchemas/bar", "", - "", ""); + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 16, "/propertyNames", "", "/~K~", "/~K~"); // Applicator vocabulary (array) EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 17, "/contains", "", "/~I~", "/~I~"); - EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 18, "/items", "", "/~I~", - "/~I~"); + EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 18, "/items", "", "/~?~/~I~", + "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 19, "/prefixItems/0", "", "/0", "/0"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 20, "/prefixItems/1", "", "/1", @@ -1659,9 +1664,9 @@ TEST(JSONSchema_official_walker_2020_12, instance_locations) { // Unevaluated vocabulary EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 21, "/unevaluatedProperties", - "", "/~P~", "/~P~"); + "", "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 22, "/unevaluatedItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); // Content vocabulary EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 23, "/contentSchema", "", "", @@ -1701,13 +1706,13 @@ TEST(JSONSchema_official_walker_2020_12, instance_locations_nested) { EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt, "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12(entries, 1, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12( entries, 2, "/additionalProperties/properties/foo", - "/additionalProperties", "/~P~/foo", "/foo"); + "/additionalProperties", "/~?~/~P~/foo", "/foo"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12( entries, 3, "/additionalProperties/properties/foo/allOf/0", - "/additionalProperties/properties/foo", "/~P~/foo", ""); + "/additionalProperties/properties/foo", "/~?~/~P~/foo", ""); } TEST(JSONSchema_official_walker_2020_12, instance_locations_defs_with_ref) { @@ -1769,5 +1774,5 @@ TEST(JSONSchema_official_walker_2020_12, definitions_subschemas) { entries, 2, "/$defs/foo/properties/bar", "/$defs/foo", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_2020_12_ORPHAN( entries, 3, "/$defs/foo/properties/bar/additionalProperties", - "/$defs/foo/properties/bar", "/bar/~P~", "/~P~"); + "/$defs/foo/properties/bar", "/bar/~?~/~P~", "/~?~/~P~"); } diff --git a/test/jsonschema/jsonschema_official_walker_draft0_test.cc b/test/jsonschema/jsonschema_official_walker_draft0_test.cc index 3e54993ff..a2b484f56 100644 --- a/test/jsonschema/jsonschema_official_walker_draft0_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft0_test.cc @@ -65,7 +65,8 @@ TEST(JSONSchema_official_walker_draft0, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT0)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-00/schema#"); @@ -76,7 +77,7 @@ TEST(JSONSchema_official_walker_draft0, additionalProperties) { TEST(JSONSchema_official_walker_draft0, type) { using namespace sourcemeta::core; const auto result{schema_official_walker("type", VOCABULARIES_DRAFT0)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-00/schema#"); @@ -440,7 +441,8 @@ TEST(JSONSchema_official_walker_draft0, hyperschema_additionalProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalProperties", VOCABULARIES_DRAFT0_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-00/hyper-schema#"); @@ -452,7 +454,7 @@ TEST(JSONSchema_official_walker_draft0, hyperschema_type) { using namespace sourcemeta::core; const auto result{ schema_official_walker("type", VOCABULARIES_DRAFT0_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-00/hyper-schema#"); @@ -792,7 +794,7 @@ TEST(JSONSchema_official_walker_draft0, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 3, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 4, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); // Applicators (array) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 5, "/items", "", "/~I~", "/~I~"); @@ -802,8 +804,10 @@ TEST(JSONSchema_official_walker_draft0, instance_locations) { "/~I~/1", "/1"); // Applicators (any) - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 8, "/type/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 9, "/type/2", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 8, "/type/1", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 9, "/type/2", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 10, "/extends", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT0(entries, 11, "/extends/extends/0", "/extends", "", ""); diff --git a/test/jsonschema/jsonschema_official_walker_draft1_test.cc b/test/jsonschema/jsonschema_official_walker_draft1_test.cc index 121ae8bd8..dfba137ce 100644 --- a/test/jsonschema/jsonschema_official_walker_draft1_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft1_test.cc @@ -65,7 +65,8 @@ TEST(JSONSchema_official_walker_draft1, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT1)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-01/schema#"); @@ -76,7 +77,7 @@ TEST(JSONSchema_official_walker_draft1, additionalProperties) { TEST(JSONSchema_official_walker_draft1, type) { using namespace sourcemeta::core; const auto result{schema_official_walker("type", VOCABULARIES_DRAFT1)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-01/schema#"); @@ -440,7 +441,8 @@ TEST(JSONSchema_official_walker_draft1, hyperschema_additionalProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalProperties", VOCABULARIES_DRAFT1_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-01/hyper-schema#"); @@ -452,7 +454,7 @@ TEST(JSONSchema_official_walker_draft1, hyperschema_type) { using namespace sourcemeta::core; const auto result{ schema_official_walker("type", VOCABULARIES_DRAFT1_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-01/hyper-schema#"); @@ -792,7 +794,7 @@ TEST(JSONSchema_official_walker_draft1, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 3, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 4, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); // Applicators (array) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 5, "/items", "", "/~I~", "/~I~"); @@ -802,8 +804,10 @@ TEST(JSONSchema_official_walker_draft1, instance_locations) { "/~I~/1", "/1"); // Applicators (any) - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 8, "/type/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 9, "/type/2", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 8, "/type/1", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 9, "/type/2", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 10, "/extends", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT1(entries, 11, "/extends/extends/0", "/extends", "", ""); diff --git a/test/jsonschema/jsonschema_official_walker_draft2_test.cc b/test/jsonschema/jsonschema_official_walker_draft2_test.cc index 0c18845b3..61ef8d819 100644 --- a/test/jsonschema/jsonschema_official_walker_draft2_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft2_test.cc @@ -65,7 +65,8 @@ TEST(JSONSchema_official_walker_draft2, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT2)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-02/schema#"); @@ -76,7 +77,7 @@ TEST(JSONSchema_official_walker_draft2, additionalProperties) { TEST(JSONSchema_official_walker_draft2, type) { using namespace sourcemeta::core; const auto result{schema_official_walker("type", VOCABULARIES_DRAFT2)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-02/schema#"); @@ -459,7 +460,8 @@ TEST(JSONSchema_official_walker_draft2, hyperschema_additionalProperties) { using namespace sourcemeta::core; const auto result{schema_official_walker("additionalProperties", VOCABULARIES_DRAFT2_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-02/hyper-schema#"); @@ -471,7 +473,7 @@ TEST(JSONSchema_official_walker_draft2, hyperschema_type) { using namespace sourcemeta::core; const auto result{ schema_official_walker("type", VOCABULARIES_DRAFT2_HYPERSCHEMA)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-02/hyper-schema#"); @@ -813,7 +815,7 @@ TEST(JSONSchema_official_walker_draft2, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 3, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 4, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); // Applicators (array) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 5, "/items", "", "/~I~", "/~I~"); @@ -823,8 +825,10 @@ TEST(JSONSchema_official_walker_draft2, instance_locations) { "/~I~/1", "/1"); // Applicators (any) - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 8, "/type/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 9, "/type/2", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 8, "/type/1", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 9, "/type/2", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 10, "/extends", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT2(entries, 11, "/extends/extends/0", "/extends", "", ""); diff --git a/test/jsonschema/jsonschema_official_walker_draft3_test.cc b/test/jsonschema/jsonschema_official_walker_draft3_test.cc index e2504bb71..c00cfec94 100644 --- a/test/jsonschema/jsonschema_official_walker_draft3_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft3_test.cc @@ -57,7 +57,7 @@ TEST(JSONSchema_official_walker_draft3, additionalItems) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalItems", VOCABULARIES_DRAFT3)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-03/schema#"); @@ -94,7 +94,7 @@ TEST(JSONSchema_official_walker_draft3, dependencies) { using namespace sourcemeta::core; const auto result{ schema_official_walker("dependencies", VOCABULARIES_DRAFT3)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-03/schema#"); @@ -106,7 +106,8 @@ TEST(JSONSchema_official_walker_draft3, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT3)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-03/schema#"); @@ -117,7 +118,7 @@ TEST(JSONSchema_official_walker_draft3, additionalProperties) { TEST(JSONSchema_official_walker_draft3, type) { using namespace sourcemeta::core; const auto result{schema_official_walker("type", VOCABULARIES_DRAFT3)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-03/schema#"); @@ -317,7 +318,7 @@ TEST(JSONSchema_official_walker_draft3, divisibleBy) { TEST(JSONSchema_official_walker_draft3, disallow) { using namespace sourcemeta::core; const auto result{schema_official_walker("disallow", VOCABULARIES_DRAFT3)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-03/schema#"); @@ -653,17 +654,17 @@ TEST(JSONSchema_official_walker_draft3, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 2, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 3, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 4, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 5, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 6, "/dependencies/baz", "", "", - ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 6, "/dependencies/baz", "", + "/~?~", "/~?~"); // Applicators (array) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 7, "/additionalItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 8, "/items", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 9, "/items/items/0", "/items", "/~I~/0", "/0"); @@ -671,10 +672,14 @@ TEST(JSONSchema_official_walker_draft3, instance_locations) { "/~I~/1", "/1"); // Applicators (any) - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 11, "/type/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 12, "/type/2", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 13, "/disallow/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 14, "/disallow/2", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 11, "/type/1", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 12, "/type/2", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 13, "/disallow/1", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 14, "/disallow/2", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 15, "/extends", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT3(entries, 16, "/extends/extends/0", "/extends", "", ""); diff --git a/test/jsonschema/jsonschema_official_walker_draft4_test.cc b/test/jsonschema/jsonschema_official_walker_draft4_test.cc index 36e9bbb15..ad122f21b 100644 --- a/test/jsonschema/jsonschema_official_walker_draft4_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft4_test.cc @@ -55,7 +55,7 @@ TEST(JSONSchema_official_walker_draft4, definitions) { TEST(JSONSchema_official_walker_draft4, allOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("allOf", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceInline); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -66,7 +66,7 @@ TEST(JSONSchema_official_walker_draft4, allOf) { TEST(JSONSchema_official_walker_draft4, anyOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("anyOf", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -77,7 +77,7 @@ TEST(JSONSchema_official_walker_draft4, anyOf) { TEST(JSONSchema_official_walker_draft4, oneOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("oneOf", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -112,7 +112,7 @@ TEST(JSONSchema_official_walker_draft4, additionalItems) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalItems", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -149,7 +149,7 @@ TEST(JSONSchema_official_walker_draft4, dependencies) { using namespace sourcemeta::core; const auto result{ schema_official_walker("dependencies", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -161,7 +161,8 @@ TEST(JSONSchema_official_walker_draft4, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT4)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-04/schema#"); @@ -678,8 +679,10 @@ TEST(JSONSchema_official_walker_draft4, instance_locations) { // Applicators (any) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 1, "/allOf/0", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 2, "/allOf/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 3, "/anyOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 4, "/oneOf/0", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 3, "/anyOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 4, "/oneOf/0", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 5, "/not", "", "", ""); // Applicators (object) @@ -688,17 +691,17 @@ TEST(JSONSchema_official_walker_draft4, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 7, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 8, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 9, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 10, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 11, "/dependencies/baz", "", "", - ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 11, "/dependencies/baz", "", + "/~?~", "/~?~"); // Applicators (array) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 12, "/additionalItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 13, "/items", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4(entries, 14, "/items/items/0", "/items", @@ -744,5 +747,5 @@ TEST(JSONSchema_official_walker_draft4, definitions_subschemas) { "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT4_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~P~", "/~P~"); + "/definitions/foo/properties/bar", "/bar/~?~/~P~", "/~?~/~P~"); } diff --git a/test/jsonschema/jsonschema_official_walker_draft6_test.cc b/test/jsonschema/jsonschema_official_walker_draft6_test.cc index 6f9bf9a71..e615c5708 100644 --- a/test/jsonschema/jsonschema_official_walker_draft6_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft6_test.cc @@ -55,7 +55,7 @@ TEST(JSONSchema_official_walker_draft6, definitions) { TEST(JSONSchema_official_walker_draft6, allOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("allOf", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceInline); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -66,7 +66,7 @@ TEST(JSONSchema_official_walker_draft6, allOf) { TEST(JSONSchema_official_walker_draft6, anyOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("anyOf", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -77,7 +77,7 @@ TEST(JSONSchema_official_walker_draft6, anyOf) { TEST(JSONSchema_official_walker_draft6, oneOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("oneOf", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -112,7 +112,7 @@ TEST(JSONSchema_official_walker_draft6, additionalItems) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalItems", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -160,7 +160,7 @@ TEST(JSONSchema_official_walker_draft6, dependencies) { using namespace sourcemeta::core; const auto result{ schema_official_walker("dependencies", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -172,7 +172,8 @@ TEST(JSONSchema_official_walker_draft6, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT6)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-06/schema#"); @@ -732,8 +733,10 @@ TEST(JSONSchema_official_walker_draft6, instance_locations) { // Applicators (any) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 1, "/allOf/0", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 2, "/allOf/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 3, "/anyOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 4, "/oneOf/0", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 3, "/anyOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 4, "/oneOf/0", "", "/~?~", + "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 5, "/not", "", "", ""); // Applicators (object) @@ -742,13 +745,13 @@ TEST(JSONSchema_official_walker_draft6, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 7, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 8, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 9, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 10, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 11, "/dependencies/baz", "", "", - ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 11, "/dependencies/baz", "", + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 12, "/propertyNames", "", "/~K~", "/~K~"); @@ -756,7 +759,7 @@ TEST(JSONSchema_official_walker_draft6, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 13, "/contains", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 14, "/additionalItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 15, "/items", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6(entries, 16, "/items/items/0", "/items", @@ -802,5 +805,5 @@ TEST(JSONSchema_official_walker_draft6, definitions_subschemas) { "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT6_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~P~", "/~P~"); + "/definitions/foo/properties/bar", "/bar/~?~/~P~", "/~?~/~P~"); } diff --git a/test/jsonschema/jsonschema_official_walker_draft7_test.cc b/test/jsonschema/jsonschema_official_walker_draft7_test.cc index e19362681..236585a81 100644 --- a/test/jsonschema/jsonschema_official_walker_draft7_test.cc +++ b/test/jsonschema/jsonschema_official_walker_draft7_test.cc @@ -66,7 +66,7 @@ TEST(JSONSchema_official_walker_draft7, comment) { TEST(JSONSchema_official_walker_draft7, allOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("allOf", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceInline); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -77,7 +77,7 @@ TEST(JSONSchema_official_walker_draft7, allOf) { TEST(JSONSchema_official_walker_draft7, anyOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("anyOf", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -88,7 +88,7 @@ TEST(JSONSchema_official_walker_draft7, anyOf) { TEST(JSONSchema_official_walker_draft7, oneOf) { using namespace sourcemeta::core; const auto result{schema_official_walker("oneOf", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorElementsInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -110,7 +110,7 @@ TEST(JSONSchema_official_walker_draft7, not) { TEST(JSONSchema_official_walker_draft7, if) { using namespace sourcemeta::core; const auto result{schema_official_walker("if", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -121,7 +121,7 @@ TEST(JSONSchema_official_walker_draft7, if) { TEST(JSONSchema_official_walker_draft7, then) { using namespace sourcemeta::core; const auto result{schema_official_walker("then", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -132,7 +132,7 @@ TEST(JSONSchema_official_walker_draft7, then) { TEST(JSONSchema_official_walker_draft7, else) { using namespace sourcemeta::core; const auto result{schema_official_walker("else", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueInPlaceMaybe); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -156,7 +156,7 @@ TEST(JSONSchema_official_walker_draft7, additionalItems) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalItems", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyItem); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseSomeItem); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -204,7 +204,7 @@ TEST(JSONSchema_official_walker_draft7, dependencies) { using namespace sourcemeta::core; const auto result{ schema_official_walker("dependencies", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlace); + EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorMembersInPlaceSome); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -216,7 +216,8 @@ TEST(JSONSchema_official_walker_draft7, additionalProperties) { using namespace sourcemeta::core; const auto result{ schema_official_walker("additionalProperties", VOCABULARIES_DRAFT7)}; - EXPECT_EQ(result.type, SchemaKeywordType::ApplicatorValueTraverseAnyProperty); + EXPECT_EQ(result.type, + SchemaKeywordType::ApplicatorValueTraverseSomeProperty); EXPECT_TRUE(result.vocabulary.has_value()); EXPECT_EQ(result.vocabulary.value(), "http://json-schema.org/draft-07/schema#"); @@ -917,11 +918,13 @@ TEST(JSONSchema_official_walker_draft7, instance_locations) { // Applicators (any) EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 1, "/allOf/0", "", "", ""); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 2, "/allOf/1", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 3, "/anyOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 4, "/oneOf/0", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 5, "/if", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 6, "/then", "", "", ""); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 7, "/else", "", "", ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 3, "/anyOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 4, "/oneOf/0", "", "/~?~", + "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 5, "/if", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 6, "/then", "", "/~?~", "/~?~"); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 7, "/else", "", "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 8, "/not", "", "", ""); // Applicators (object) @@ -930,13 +933,13 @@ TEST(JSONSchema_official_walker_draft7, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 10, "/properties/bar", "", "/bar", "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 11, "/additionalProperties", "", - "/~P~", "/~P~"); + "/~?~/~P~", "/~?~/~P~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 12, "/patternProperties/^f", "", "/~R^f~", "/~R^f~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 13, "/patternProperties/x$", "", "/~Rx$~", "/~Rx$~"); - EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 14, "/dependencies/baz", "", "", - ""); + EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 14, "/dependencies/baz", "", + "/~?~", "/~?~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 15, "/propertyNames", "", "/~K~", "/~K~"); @@ -944,7 +947,7 @@ TEST(JSONSchema_official_walker_draft7, instance_locations) { EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 16, "/contains", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 17, "/additionalItems", "", - "/~I~", "/~I~"); + "/~?~/~I~", "/~?~/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 18, "/items", "", "/~I~", "/~I~"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7(entries, 19, "/items/items/0", "/items", @@ -990,5 +993,5 @@ TEST(JSONSchema_official_walker_draft7, definitions_subschemas) { "/bar"); EXPECT_OFFICIAL_WALKER_ENTRY_DRAFT7_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~P~", "/~P~"); + "/definitions/foo/properties/bar", "/bar/~?~/~P~", "/~?~/~P~"); } diff --git a/test/jsonschema/jsonschema_walker_test.cc b/test/jsonschema/jsonschema_walker_test.cc index f88f6a394..49f00b121 100644 --- a/test/jsonschema/jsonschema_walker_test.cc +++ b/test/jsonschema/jsonschema_walker_test.cc @@ -38,7 +38,7 @@ static auto test_walker(std::string_view keyword, vocabularies.end()) { if (keyword == "schema") { return {sourcemeta::core::SchemaKeywordType:: - ApplicatorValueTraverseAnyProperty, + ApplicatorValueTraverseSomeProperty, "https://sourcemeta.com/vocab/test-1", {}}; } @@ -69,7 +69,7 @@ static auto test_walker(std::string_view keyword, vocabularies.end()) { if (keyword == "custom") { return {sourcemeta::core::SchemaKeywordType:: - ApplicatorValueTraverseAnyProperty, + ApplicatorValueTraverseSomeProperty, "https://sourcemeta.com/vocab/test-2", {}}; }