diff --git a/.gitignore b/.gitignore index 7d4cb73d..7334737e 100644 --- a/.gitignore +++ b/.gitignore @@ -235,3 +235,4 @@ dist .DS_Store CMakeUserPresets.json Brewfile.lock.json +!/vendor/**/out diff --git a/DEPENDENCIES b/DEPENDENCIES index f16c548e..3892a640 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,4 +1,4 @@ vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02 -core https://github.com/sourcemeta/core 4b948ea794732147e017281c523c1b6f934c8174 -blaze https://github.com/sourcemeta/blaze 32e5c5d68aaad434bedb0a2c59d86e0a08478057 +core https://github.com/sourcemeta/core 5dabb7f983b54e302b35ab74547b58c86576537b +blaze https://github.com/sourcemeta/blaze f25c2ab22cb13964a47be77acb8bbcc01ad1f2dd bootstrap https://github.com/twbs/bootstrap 1a6fdfae6be09b09eaced8f0e442ca6f7680a61e diff --git a/src/compiler/mapper/enum_8_bit.h b/src/compiler/mapper/enum_8_bit.h index e5cc8806..f5c6032e 100644 --- a/src/compiler/mapper/enum_8_bit.h +++ b/src/compiler/mapper/enum_8_bit.h @@ -5,15 +5,14 @@ class Enum8Bit final : public sourcemeta::blaze::SchemaTransformRule { using reframe_after_transform = std::true_type; Enum8Bit() : sourcemeta::blaze::SchemaTransformRule{"enum_8_bit", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/enum_8_bit_top_level.h b/src/compiler/mapper/enum_8_bit_top_level.h index 0a1ab28c..7810e8f4 100644 --- a/src/compiler/mapper/enum_8_bit_top_level.h +++ b/src/compiler/mapper/enum_8_bit_top_level.h @@ -5,15 +5,14 @@ class Enum8BitTopLevel final : public sourcemeta::blaze::SchemaTransformRule { Enum8BitTopLevel() : sourcemeta::blaze::SchemaTransformRule{"enum_8_bit_top_level", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/enum_arbitrary.h b/src/compiler/mapper/enum_arbitrary.h index b95e13db..34b4b5a9 100644 --- a/src/compiler/mapper/enum_arbitrary.h +++ b/src/compiler/mapper/enum_arbitrary.h @@ -6,15 +6,14 @@ class EnumArbitrary final : public sourcemeta::blaze::SchemaTransformRule { EnumArbitrary() : sourcemeta::blaze::SchemaTransformRule{"enum_arbitrary", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/enum_singleton.h b/src/compiler/mapper/enum_singleton.h index 2690b92e..bc61d34d 100644 --- a/src/compiler/mapper/enum_singleton.h +++ b/src/compiler/mapper/enum_singleton.h @@ -5,15 +5,14 @@ class EnumSingleton final : public sourcemeta::blaze::SchemaTransformRule { EnumSingleton() : sourcemeta::blaze::SchemaTransformRule{"enum_singleton", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_bounded_8_bit.h b/src/compiler/mapper/integer_bounded_8_bit.h index 0c5a524b..c9661da6 100644 --- a/src/compiler/mapper/integer_bounded_8_bit.h +++ b/src/compiler/mapper/integer_bounded_8_bit.h @@ -5,15 +5,14 @@ class IntegerBounded8Bit final : public sourcemeta::blaze::SchemaTransformRule { IntegerBounded8Bit() : sourcemeta::blaze::SchemaTransformRule{"integer_bounded_8_bit", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_bounded_greater_than_8_bit.h b/src/compiler/mapper/integer_bounded_greater_than_8_bit.h index 7983adec..85f8fe65 100644 --- a/src/compiler/mapper/integer_bounded_greater_than_8_bit.h +++ b/src/compiler/mapper/integer_bounded_greater_than_8_bit.h @@ -7,15 +7,14 @@ class IntegerBoundedGreaterThan8Bit final : sourcemeta::blaze::SchemaTransformRule{ "integer_bounded_greater_than_8_bit", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_bounded_multiplier_8_bit.h b/src/compiler/mapper/integer_bounded_multiplier_8_bit.h index 2a5eb044..29414f41 100644 --- a/src/compiler/mapper/integer_bounded_multiplier_8_bit.h +++ b/src/compiler/mapper/integer_bounded_multiplier_8_bit.h @@ -7,15 +7,14 @@ class IntegerBoundedMultiplier8Bit final : sourcemeta::blaze::SchemaTransformRule{ "integer_bounded_multiplier_8_bit", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { if (location.dialect != "https://json-schema.org/draft/2020-12/schema" || !vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_bounded_multiplier_greater_than_8_bit.h b/src/compiler/mapper/integer_bounded_multiplier_greater_than_8_bit.h index 8a304b99..267399c4 100644 --- a/src/compiler/mapper/integer_bounded_multiplier_greater_than_8_bit.h +++ b/src/compiler/mapper/integer_bounded_multiplier_greater_than_8_bit.h @@ -7,15 +7,14 @@ class IntegerBoundedMultiplierGreaterThan8Bit final : sourcemeta::blaze::SchemaTransformRule{ "integer_bounded_multiplier_greater_than_8_bit", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { if (location.dialect != "https://json-schema.org/draft/2020-12/schema" || !vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_lower_bound.h b/src/compiler/mapper/integer_lower_bound.h index 25071e39..d9a68ff3 100644 --- a/src/compiler/mapper/integer_lower_bound.h +++ b/src/compiler/mapper/integer_lower_bound.h @@ -5,15 +5,14 @@ class IntegerLowerBound final : public sourcemeta::blaze::SchemaTransformRule { IntegerLowerBound() : sourcemeta::blaze::SchemaTransformRule{"integer_lower_bound", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_lower_bound_multiplier.h b/src/compiler/mapper/integer_lower_bound_multiplier.h index b34f8c32..e0a1195c 100644 --- a/src/compiler/mapper/integer_lower_bound_multiplier.h +++ b/src/compiler/mapper/integer_lower_bound_multiplier.h @@ -7,15 +7,14 @@ class IntegerLowerBoundMultiplier final : sourcemeta::blaze::SchemaTransformRule{"integer_lower_bound_multiplier", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_unbound.h b/src/compiler/mapper/integer_unbound.h index 32fca495..506df0bd 100644 --- a/src/compiler/mapper/integer_unbound.h +++ b/src/compiler/mapper/integer_unbound.h @@ -5,15 +5,14 @@ class IntegerUnbound final : public sourcemeta::blaze::SchemaTransformRule { IntegerUnbound() : sourcemeta::blaze::SchemaTransformRule{"integer_unbound", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_unbound_multiplier.h b/src/compiler/mapper/integer_unbound_multiplier.h index 4d060b24..2e839fde 100644 --- a/src/compiler/mapper/integer_unbound_multiplier.h +++ b/src/compiler/mapper/integer_unbound_multiplier.h @@ -7,15 +7,14 @@ class IntegerUnboundMultiplier final : sourcemeta::blaze::SchemaTransformRule{"integer_unbound_multiplier", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_upper_bound.h b/src/compiler/mapper/integer_upper_bound.h index 60969dc4..c6b4009d 100644 --- a/src/compiler/mapper/integer_upper_bound.h +++ b/src/compiler/mapper/integer_upper_bound.h @@ -5,15 +5,14 @@ class IntegerUpperBound final : public sourcemeta::blaze::SchemaTransformRule { IntegerUpperBound() : sourcemeta::blaze::SchemaTransformRule{"integer_upper_bound", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/integer_upper_bound_multiplier.h b/src/compiler/mapper/integer_upper_bound_multiplier.h index 7ece146f..404e2b0a 100644 --- a/src/compiler/mapper/integer_upper_bound_multiplier.h +++ b/src/compiler/mapper/integer_upper_bound_multiplier.h @@ -7,15 +7,14 @@ class IntegerUpperBoundMultiplier final : sourcemeta::blaze::SchemaTransformRule{"integer_upper_bound_multiplier", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/src/compiler/mapper/number_arbitrary.h b/src/compiler/mapper/number_arbitrary.h index c2be25ab..a8137925 100644 --- a/src/compiler/mapper/number_arbitrary.h +++ b/src/compiler/mapper/number_arbitrary.h @@ -5,15 +5,14 @@ class NumberArbitrary final : public sourcemeta::blaze::SchemaTransformRule { NumberArbitrary() : sourcemeta::blaze::SchemaTransformRule{"number_arbitrary", ""} {}; - [[nodiscard]] auto - condition(const sourcemeta::core::JSON &schema, - [[maybe_unused]] const sourcemeta::core::JSON &root, - const sourcemeta::core::SchemaVocabularies &vocabularies, - [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Location &location, - [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, - [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver, - [[maybe_unused]] const bool is_metaschema) const + [[nodiscard]] auto condition( + const sourcemeta::core::JSON &schema, + [[maybe_unused]] const sourcemeta::core::JSON &root, + const sourcemeta::core::SchemaVocabularies &vocabularies, + [[maybe_unused]] const sourcemeta::core::SchemaFrame &frame, + const sourcemeta::core::SchemaFrame::Location &location, + [[maybe_unused]] const sourcemeta::core::SchemaWalker &walker, + [[maybe_unused]] const sourcemeta::core::SchemaResolver &resolver) const -> sourcemeta::blaze::SchemaTransformRule::Result override { return location.dialect == "https://json-schema.org/draft/2020-12/schema" && vocabularies.contains(sourcemeta::core::SchemaVocabularies::Known:: diff --git a/vendor/blaze/CMakeLists.txt b/vendor/blaze/CMakeLists.txt index 3e5a8b1a..d0e6be38 100644 --- a/vendor/blaze/CMakeLists.txt +++ b/vendor/blaze/CMakeLists.txt @@ -13,6 +13,7 @@ option(BLAZE_CONFIGURATION "Build the Blaze configuration file library" ON) option(BLAZE_ALTERSCHEMA "Build the Blaze alterschema rule library" ON) option(BLAZE_CODEGEN "Build the Blaze codegen library" ON) option(BLAZE_CANONICALIZER "Build the Blaze canonicalizer library" ON) +option(BLAZE_CONVERT "Build the Blaze convert library" ON) option(BLAZE_EDITOR "Build the Blaze editor schema compatibility library" ON) option(BLAZE_BUNDLE "Build the Blaze bundle library" ON) option(BLAZE_FORMAT "Build the Blaze format library" ON) @@ -95,6 +96,10 @@ if(BLAZE_CANONICALIZER) add_subdirectory(src/canonicalizer) endif() +if(BLAZE_CONVERT) + add_subdirectory(src/convert) +endif() + if(BLAZE_EDITOR) add_subdirectory(src/editor) endif() @@ -185,6 +190,10 @@ if(BLAZE_TESTS) add_subdirectory(test/canonicalizer) endif() + if(BLAZE_CONVERT) + add_subdirectory(test/convert) + endif() + if(BLAZE_EDITOR) add_subdirectory(test/editor) endif() diff --git a/vendor/blaze/DEPENDENCIES b/vendor/blaze/DEPENDENCIES index 5bcbed29..5e63aabc 100644 --- a/vendor/blaze/DEPENDENCIES +++ b/vendor/blaze/DEPENDENCIES @@ -1,3 +1,3 @@ vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02 -core https://github.com/sourcemeta/core 4b948ea794732147e017281c523c1b6f934c8174 +core https://github.com/sourcemeta/core 5dabb7f983b54e302b35ab74547b58c86576537b jsonschema-test-suite https://github.com/json-schema-org/JSON-Schema-Test-Suite 6648e8194c69697b2e1a15fe76a06a480b183a51 diff --git a/vendor/blaze/config.cmake.in b/vendor/blaze/config.cmake.in index 98cfeb55..3b3d6aeb 100644 --- a/vendor/blaze/config.cmake.in +++ b/vendor/blaze/config.cmake.in @@ -12,6 +12,7 @@ if(NOT BLAZE_COMPONENTS) list(APPEND BLAZE_COMPONENTS alterschema) list(APPEND BLAZE_COMPONENTS codegen) list(APPEND BLAZE_COMPONENTS canonicalizer) + list(APPEND BLAZE_COMPONENTS convert) list(APPEND BLAZE_COMPONENTS editor) list(APPEND BLAZE_COMPONENTS bundle) list(APPEND BLAZE_COMPONENTS format) @@ -55,6 +56,8 @@ foreach(component ${BLAZE_COMPONENTS}) include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_codegen.cmake") elseif(component STREQUAL "canonicalizer") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_canonicalizer.cmake") + elseif(component STREQUAL "convert") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_convert.cmake") elseif(component STREQUAL "editor") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_editor.cmake") elseif(component STREQUAL "bundle") diff --git a/vendor/blaze/ports/javascript/index.mjs b/vendor/blaze/ports/javascript/index.mjs index bd76d551..3a1d47e4 100644 --- a/vendor/blaze/ports/javascript/index.mjs +++ b/vendor/blaze/ports/javascript/index.mjs @@ -323,8 +323,9 @@ function compileInstructionToCode(instruction, captures, visited, budget) { case 68: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; return r+TO+'return true;for(var k in t){'+lb(children,'t[k]')+'}return true;'; } case 69: return fb(69); case 70: return fb(70); case 71: return fb(71); case 72: return fb(72); case 73: return fb(73); case 74: return fb(74); case 75: return fb(75); case 76: return fb(76); - case 77: { var r=R('t'); return r?r+TO+'return true;for(var k in t){if(_es(t[k])!=='+value+')return false;}return true;':null; } - case 78: return fb(78); case 79: return fb(79); case 80: return fb(80); case 81: return fb(81); + case 77: return fb(77); + case 78: { var r=R('t'); return r?r+TO+'return true;for(var k in t){if(_es(t[k])!=='+value+')return false;}return true;':null; } + case 79: return fb(79); case 80: return fb(80); case 81: return fb(81); case 82: return fb(82); case 83: { var r=R('t'); if(!r)return null; if(!children||children.length===0)return r+'return true;'; return r+'if(!Array.isArray(t))return true;for(var j=0;j=t.length)return true;for(var j='+value+';j +#include #include #include #include @@ -15,10 +16,11 @@ #include // assert #include // std::floor, std::ceil, std::isfinite #include // std::size_t -#include // std::ref +#include // std::ref, std::reference_wrapper #include // std::back_inserter #include // std::numeric_limits #include // std::unique_ptr, std::make_unique +#include // std::optional #include // std::ostringstream #include // std::string_view #include // std::unordered_map @@ -135,6 +137,131 @@ auto walk_up_in_place_applicators(const JSON &root, const SchemaFrame &frame, is_in_place_applicator, matches); } +// Compile a subschema of a wrapper document, whose frame locates schemas +// within it rather than one at its top. Every schema that the frame locates is +// bundled into a copy of the document at once, so that the subschema may +// reference any of them as well as a remote schema +inline auto compile_embedded_subschema(const JSON &root, + const SchemaFrame &frame, + const SchemaFrame::Location &location, + const SchemaWalker &walker, + const SchemaResolver &resolver, + const Compiler &compiler) -> Template { + std::unordered_set roots; + std::string_view default_dialect{location.dialect}; + std::string_view default_base; + frame.for_each_subschema([&](const SchemaFrame::Location &entry) -> void { + if (entry.parent.has_value()) { + return; + } + + const auto [iterator, inserted] = roots.insert(to_pointer(entry.pointer)); + if (!inserted) { + return; + } + + // A schema that declares no dialect of its own reports the default one + // that the document was framed with + if (declared_dialect(get(root, *iterator)).empty()) { + default_dialect = entry.dialect; + } + + // A schema that declares no identifier of its own is addressed from the + // top of the document, by the base that the document was framed with + if (entry.relative_pointer == 0) { + default_base = entry.base; + } + }); + + SchemaFrame::Paths paths; + paths.reserve(roots.size()); + for (const auto &pointer : roots) { + paths.push_back(to_weak_pointer(pointer)); + } + + // A wrapper document may declare a member of this name of its own, so bundle + // into one that it does not declare, which then only holds what bundling + // embedded + JSON::String container_name{"x-sourcemeta-embedded"}; + while (root.defines(container_name)) { + container_name.push_back('_'); + } + + const Pointer container{container_name}; + auto document{root}; + bundle(document, walker, resolver, BundleMode::References, default_dialect, + "", container, paths, default_base); + + // Bundling embeds every remote schema into the container, outside of every + // schema that the frame located, so each of them is framed as a schema too + std::vector embedded; + const auto *remotes{document.try_at(container_name)}; + if (remotes != nullptr) { + embedded.reserve(remotes->size()); + for (const auto &entry : remotes->as_object()) { + embedded.push_back(container.concat(Pointer{entry.first})); + } + } + + for (const auto &pointer : embedded) { + paths.push_back(to_weak_pointer(pointer)); + } + + const SchemaFrame bundled_frame{SchemaFrame::Mode::References, + document, + walker, + resolver, + default_dialect, + "", + SchemaFrame::IdentifierMode::Additional, + paths, + default_base}; + const auto entrypoint{bundled_frame.uri(location.pointer)}; + assert(entrypoint.has_value()); + return compile(document, walker, resolver, compiler, bundled_frame, + entrypoint.value().get(), Mode::Exhaustive); +} + +// Compile the subschema at a location of a frame that does not stand alone, +// setting the base that evaluate paths are relative to, or report nothing if +// it does not compile +inline auto compile_non_standalone_subschema( + const JSON &root, const SchemaFrame &frame, + const SchemaFrame::Location &location, const SchemaWalker &walker, + const SchemaResolver &resolver, const Compiler &compiler, WeakPointer &base) + -> std::optional