diff --git a/src/core/jsonpointer/CMakeLists.txt b/src/core/jsonpointer/CMakeLists.txt index 2cb95a389..20300551b 100644 --- a/src/core/jsonpointer/CMakeLists.txt +++ b/src/core/jsonpointer/CMakeLists.txt @@ -1,6 +1,6 @@ sourcemeta_library(NAMESPACE sourcemeta PROJECT core NAME jsonpointer PRIVATE_HEADERS pointer.h position.h error.h token.h - walker.h template.h + walker.h SOURCES jsonpointer.cc stringify.h parser.h grammar.h position.cc mangle.cc) if(SOURCEMETA_CORE_INSTALL) diff --git a/src/core/jsonpointer/include/sourcemeta/core/jsonpointer.h b/src/core/jsonpointer/include/sourcemeta/core/jsonpointer.h index 7354ca70d..61da59fc4 100644 --- a/src/core/jsonpointer/include/sourcemeta/core/jsonpointer.h +++ b/src/core/jsonpointer/include/sourcemeta/core/jsonpointer.h @@ -12,7 +12,6 @@ #include #include #include -#include #include // NOLINTEND(misc-include-cleaner) @@ -50,10 +49,6 @@ const Pointer empty_pointer; /// A global constant instance of the empty JSON WeakPointer. const WeakPointer empty_weak_pointer; -/// @ingroup jsonpointer -/// A JSON Pointer with unresolved wildcards -using PointerTemplate = GenericPointerTemplate; - /// @ingroup jsonpointer /// Get a value from a JSON document using a JSON Pointer (`const` overload). /// @@ -466,27 +461,6 @@ auto stringify(const WeakPointer &pointer, std::basic_ostream &stream) -> void; -/// @ingroup jsonpointer -/// -/// Stringify the input JSON Pointer template into a given C++ standard output -/// stream. For example: -/// -/// ```cpp -/// #include -/// #include -/// #include -/// -/// const sourcemeta::core::Pointer base{"foo", "bar"}; -/// const sourcemeta::core::PointerTemplate pointer{base}; -/// std::ostringstream stream; -/// sourcemeta::core::stringify(pointer, stream); -/// std::cout << stream.str() << std::endl; -/// ``` -SOURCEMETA_CORE_JSONPOINTER_EXPORT -auto stringify(const PointerTemplate &pointer, - std::basic_ostream &stream) - -> void; - /// @ingroup jsonpointer /// /// Stringify the input JSON Pointer into a C++ standard string. For example: @@ -525,27 +499,6 @@ auto to_string(const WeakPointer &pointer) -> std::basic_string>; -/// @ingroup jsonpointer -/// -/// Stringify the input JSON Pointer template into a C++ standard string. For -/// example: -/// -/// ```cpp -/// #include -/// #include -/// #include -/// -/// sourcemeta::core::PointerTemplate pointer; -/// pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); -/// pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); -/// const std::string result{sourcemeta::core::to_string(pointer)}; -/// std::cout << result << '\n'; -/// ``` -SOURCEMETA_CORE_JSONPOINTER_EXPORT -auto to_string(const PointerTemplate &pointer) - -> std::basic_string>; - /// @ingroup jsonpointer /// /// Mangle a JSON Pointer template and prefix into a collision-free identifier. @@ -574,13 +527,12 @@ auto to_string(const PointerTemplate &pointer) /// #include /// #include /// -/// const sourcemeta::core::PointerTemplate pointer{"foo", "bar"}; +/// const sourcemeta::core::Pointer pointer{"foo", "bar"}; /// const auto result{sourcemeta::core::mangle(pointer, "schema")}; /// assert(result == "Schema_Foo_Bar"); /// ``` SOURCEMETA_CORE_JSONPOINTER_EXPORT -auto mangle(const PointerTemplate &pointer, std::string_view prefix) - -> std::string; +auto mangle(const Pointer &pointer, std::string_view prefix) -> std::string; /// @ingroup jsonpointer /// @@ -717,41 +669,6 @@ struct hash -struct hash> { - auto operator()(const sourcemeta::core::GenericPointerTemplate - &pointer) const noexcept -> std::size_t { - const auto size{pointer.size()}; - if (size == 0) { - return size; - } - - auto hash_element = - [](const typename sourcemeta::core::GenericPointerTemplate< - PointerT>::value_type &element) -> std::size_t { - using Template = sourcemeta::core::GenericPointerTemplate; - const auto *token{std::get_if(&element)}; - if (token) { - return token->is_property() - ? static_cast(token->property_hash().a) - : token->to_index(); - } else { - return element.index(); - } - }; - - const auto &first{*pointer.cbegin()}; - const auto &middle{ - *(pointer.cbegin() + - static_cast::difference_type>(size / 2))}; - const auto &last{*(pointer.cend() - 1)}; - - return size + hash_element(first) + hash_element(middle) + - hash_element(last); - } -}; } // namespace std #endif diff --git a/src/core/jsonpointer/include/sourcemeta/core/jsonpointer_template.h b/src/core/jsonpointer/include/sourcemeta/core/jsonpointer_template.h deleted file mode 100644 index 0fdfcc7f3..000000000 --- a/src/core/jsonpointer/include/sourcemeta/core/jsonpointer_template.h +++ /dev/null @@ -1,383 +0,0 @@ -#ifndef SOURCEMETA_CORE_JSONPOINTER_TEMPLATE_H_ -#define SOURCEMETA_CORE_JSONPOINTER_TEMPLATE_H_ - -#include - -#include // std::copy, std::all_of -#include // assert -#include // std::uint8_t -#include // std::initializer_list -#include // std::back_inserter -#include // std::optional, std::nullopt -#include // std::is_convertible_v, std::is_null_pointer_v -#include // std::forward -#include // std::variant, std::holds_alternative, std::get -#include // std::vector - -namespace sourcemeta::core { - -/// @ingroup jsonpointer -template class GenericPointerTemplate { -public: - enum class Wildcard : std::uint8_t { Property, Item, Key }; - struct Condition { - auto operator==(const Condition &) const noexcept -> bool = default; - auto operator<(const Condition &) const noexcept -> bool { return false; } - std::optional suffix = std::nullopt; - }; - struct Negation { - auto operator==(const Negation &) const noexcept -> bool = default; - auto operator<(const Negation &) const noexcept -> bool { return false; } - }; - using Regex = typename PointerT::Value::String; - using Token = typename PointerT::Token; - using Container = - std::vector>; - - /// This constructor creates an empty JSON Pointer template. For example: - /// - /// ```cpp - /// #include - /// - /// const sourcemeta::core::PointerTemplate pointer; - /// ``` - GenericPointerTemplate() : data{} {} - - /// This constructor is the preferred way of creating a pointer template. - /// For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::PointerTemplate pointer{ - /// "foo", - /// sourcemeta::core::PointerTemplate::Wildcard::Property}; - /// ``` - GenericPointerTemplate( - std::initializer_list tokens) - : data{std::move(tokens)} {} - - /// This constructor creates a JSON Pointer template from properties or - /// indexes. For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::PointerTemplate pointer_1{"foo", "bar", "baz"}; - /// assert(pointer_1.size() == 3); - /// const sourcemeta::core::PointerTemplate pointer_2{"foo", 1, "bar"}; - /// assert(pointer_2.size() == 3); - /// ``` - template - requires(sizeof...(Args) > 0 && - ((!std::is_null_pointer_v> && - (std::is_convertible_v || - std::is_integral_v>)) && - ...)) - GenericPointerTemplate(Args &&...args) - : data{Token{std::forward(args)}...} {} - - /// This constructor creates a JSON Pointer template from an existing JSON - /// Pointer. For example: - /// - /// ```cpp - /// #include - /// - /// const sourcemeta::core::Pointer base{"foo", "bar"}; - /// const sourcemeta::core::PointerTemplate pointer{base}; - /// ``` - GenericPointerTemplate(const PointerT &other) { this->push_back(other); } - - // Member types - using value_type = typename Container::value_type; - using allocator_type = typename Container::allocator_type; - using size_type = typename Container::size_type; - using difference_type = typename Container::difference_type; - using reference = typename Container::reference; - using const_reference = typename Container::const_reference; - using pointer = typename Container::pointer; - using const_pointer = typename Container::const_pointer; - using iterator = typename Container::iterator; - using const_iterator = typename Container::const_iterator; - using reverse_iterator = typename Container::reverse_iterator; - using const_reverse_iterator = typename Container::const_reverse_iterator; - - /// Get a mutable begin iterator on the pointer - auto begin() noexcept -> iterator { return this->data.begin(); } - /// Get a mutable end iterator on the pointer - auto end() noexcept -> iterator { return this->data.end(); } - /// Get a constant begin iterator on the pointer - [[nodiscard]] auto begin() const noexcept -> const_iterator { - return this->data.begin(); - } - /// Get a constant end iterator on the pointer - [[nodiscard]] auto end() const noexcept -> const_iterator { - return this->data.end(); - } - /// Get a constant begin iterator on the pointer - [[nodiscard]] auto cbegin() const noexcept -> const_iterator { - return this->data.cbegin(); - } - /// Get a constant end iterator on the pointer - [[nodiscard]] auto cend() const noexcept -> const_iterator { - return this->data.cend(); - } - /// Get a mutable reverse begin iterator on the pointer - auto rbegin() noexcept -> reverse_iterator { return this->data.rbegin(); } - /// Get a mutable reverse end iterator on the pointer - auto rend() noexcept -> reverse_iterator { return this->data.rend(); } - /// Get a constant reverse begin iterator on the pointer - [[nodiscard]] auto rbegin() const noexcept -> const_reverse_iterator { - return this->data.rbegin(); - } - /// Get a constant reverse end iterator on the pointer - [[nodiscard]] auto rend() const noexcept -> const_reverse_iterator { - return this->data.rend(); - } - /// Get a constant reverse begin iterator on the pointer - [[nodiscard]] auto crbegin() const noexcept -> const_reverse_iterator { - return this->data.crbegin(); - } - /// Get a constant reverse end iterator on the pointer - [[nodiscard]] auto crend() const noexcept -> const_reverse_iterator { - return this->data.crend(); - } - - /// Emplace a token or wildcard into the back of a JSON Pointer template. For - /// example: - /// - /// ```cpp - /// #include - /// - /// sourcemeta::core::PointerTemplate pointer; - /// pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - /// ``` - template auto emplace_back(Args &&...args) -> reference { - return this->data.emplace_back(std::forward(args)...); - } - - /// Push a copy of a JSON Pointer into the back of a JSON Pointer template. - /// For example: - /// - /// ```cpp - /// #include - /// - /// sourcemeta::core::PointerTemplate result; - /// const sourcemeta::core::Pointer pointer{"bar", "baz"}; - /// result.push_back(pointer); - /// ``` - auto push_back(const PointerT &other) -> void { - this->data.reserve(this->data.size() + other.size()); - std::copy(other.cbegin(), other.cend(), std::back_inserter(this->data)); - } - - /// Remove the last token of a JSON Pointer template. For example: - /// - /// ```cpp - /// #include - /// - /// const sourcemeta::core::Pointer base{"bar", "baz"}; - /// sourcemeta::core::PointerTemplate pointer{base}; - /// pointer.pop_back(); - /// ``` - auto pop_back() -> void { - assert(!this->empty()); - this->data.pop_back(); - } - - /// Concatenate a JSON Pointer template with another JSON Pointer template, - /// getting a new pointer template as a result. For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::Pointer pointer_left{"foo"}; - /// const sourcemeta::core::Pointer pointer_right{"bar", "baz"}; - /// const sourcemeta::core::Pointer pointer_expected{"foo", "bar", "baz"}; - /// - /// const sourcemeta::core::PointerTemplate left{pointer_left}; - /// const sourcemeta::core::PointerTemplate right{pointer_right}; - /// const sourcemeta::core::PointerTemplate expected{pointer_expected}; - /// - /// assert(left.concat(right) == expected); - /// ``` - [[nodiscard]] auto - concat(const GenericPointerTemplate &&other) const - -> GenericPointerTemplate { - GenericPointerTemplate result{*this}; - result.data.reserve(result.data.size() + other.data.size()); - for (auto &&token : other) { - result.emplace_back(std::move(token)); - } - - return result; - } - - /// Check if a JSON Pointer template is empty. - /// For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::PointerTemplate empty_pointer; - /// assert(empty_pointer.empty()); - /// ``` - [[nodiscard]] auto empty() const noexcept -> bool { - return this->data.empty(); - } - - /// Get the size of the JSON Pointer template. For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::Pointer base{"foo", "bar"}; - /// const sourcemeta::core::PointerTemplate pointer{base}; - /// assert(pointer.size() == 2); - /// ``` - [[nodiscard]] auto size() const noexcept -> size_type { - return this->data.size(); - } - - /// Check if a JSON Pointer template only consists in normal non-templated - /// tokens. For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// sourcemeta::core::PointerTemplate pointer; - /// pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - /// pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - /// assert(!pointer.trivial()); - /// ``` - [[nodiscard]] auto trivial() const noexcept -> bool { - return std::all_of( - this->data.cbegin(), this->data.cend(), - [](const auto &token) { return std::holds_alternative(token); }); - } - - /// Check if a JSON Pointer template matches another JSON Pointer template. - /// For example: - /// - /// ```cpp - /// #include - /// #include - /// - /// const sourcemeta::core::PointerTemplate left{ - /// sourcemeta::core::PointerTemplate::Condition{}, - /// sourcemeta::core::Pointer::Token{"foo"}}; - /// const sourcemeta::core::PointerTemplate right{ - /// sourcemeta::core::Pointer::Token{"foo"}}; - /// - /// assert(left.matches(right)); - /// assert(right.matches(left)); - /// ``` - [[nodiscard]] auto - matches(const GenericPointerTemplate &other) const noexcept - -> bool { - // TODO: Find a way to simplify this long method - auto iterator_this = this->data.cbegin(); - auto iterator_that = other.data.cbegin(); - - while (iterator_this != this->data.cend() && - iterator_that != other.data.cend()) { - while (iterator_this != this->data.cend() && - std::holds_alternative(*iterator_this)) { - iterator_this += 1; - } - - while (iterator_that != other.data.cend() && - std::holds_alternative(*iterator_that)) { - iterator_that += 1; - } - - if (iterator_this == this->data.cend() || - iterator_that == other.data.cend()) { - break; - } else if (*iterator_this != *iterator_that) { - // Handle regular expressions - if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - const auto &token{std::get(*iterator_this)}; - if (!token.is_property() || - !sourcemeta::core::matches_if_valid( - std::get(*iterator_that), token.to_property())) { - return false; - } - } else if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - const auto &token{std::get(*iterator_that)}; - if (!token.is_property() || - !sourcemeta::core::matches_if_valid( - std::get(*iterator_this), token.to_property())) { - return false; - } - - // Handle wildcards - } else if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - const auto &token{std::get(*iterator_that)}; - const auto wildcard{std::get(*iterator_this)}; - if (wildcard == Wildcard::Key || - (wildcard == Wildcard::Property && !token.is_property()) || - (wildcard == Wildcard::Item && !token.is_index())) { - return false; - } - } else if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - const auto &token{std::get(*iterator_this)}; - const auto wildcard{std::get(*iterator_that)}; - if (wildcard == Wildcard::Key || - (wildcard == Wildcard::Property && !token.is_property()) || - (wildcard == Wildcard::Item && !token.is_index())) { - return false; - } - } else if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - if (std::get(*iterator_that) != Wildcard::Property) { - return false; - } - } else if (std::holds_alternative(*iterator_this) && - std::holds_alternative(*iterator_that)) { - if (std::get(*iterator_this) != Wildcard::Property) { - return false; - } - } else { - return false; - } - } - - iterator_this += 1; - iterator_that += 1; - } - - return iterator_this == this->data.cend() && - iterator_that == other.data.cend(); - } - - /// Compare JSON Pointer template instances - auto operator==(const GenericPointerTemplate &other) const noexcept - -> bool { - return this->data == other.data; - } - - /// Overload to support ordering of JSON Pointer templates. Typically for - /// sorting reasons. - auto operator<(const GenericPointerTemplate &other) const noexcept - -> bool { - return this->data < other.data; - } - -private: - Container data; -}; - -} // namespace sourcemeta::core - -#endif diff --git a/src/core/jsonpointer/jsonpointer.cc b/src/core/jsonpointer/jsonpointer.cc index 330afee48..8a645a7fc 100644 --- a/src/core/jsonpointer/jsonpointer.cc +++ b/src/core/jsonpointer/jsonpointer.cc @@ -347,12 +347,6 @@ auto stringify(const WeakPointer &pointer, stringify(pointer, stream); } -auto stringify(const PointerTemplate &pointer, - std::basic_ostream &stream) - -> void { - stringify(pointer, stream); -} - auto to_string(const Pointer &pointer) -> std::basic_string> { @@ -373,16 +367,6 @@ auto to_string(const WeakPointer &pointer) return result.str(); } -auto to_string(const PointerTemplate &pointer) - -> std::basic_string> { - std::basic_ostringstream> - result; - stringify(pointer, result); - return result.str(); -} - auto to_uri(const Pointer &pointer) -> URI { std::basic_ostringstream> diff --git a/src/core/jsonpointer/mangle.cc b/src/core/jsonpointer/mangle.cc index eaab7be97..64cfb3176 100644 --- a/src/core/jsonpointer/mangle.cc +++ b/src/core/jsonpointer/mangle.cc @@ -4,7 +4,6 @@ #include // std::setfill, std::setw #include // std::ostringstream #include // std::string_view -#include // std::visit namespace { @@ -24,12 +23,7 @@ constexpr auto RESERVED_Z_LOWER = 'z'; // Special token markers constexpr std::string_view TOKEN_EMPTY = "ZEmpty"; -constexpr std::string_view TOKEN_WILDCARD_PROPERTY = "ZAnyProperty"; -constexpr std::string_view TOKEN_WILDCARD_ITEM = "ZAnyItem"; -constexpr std::string_view TOKEN_WILDCARD_KEY = "ZAnyKey"; -constexpr std::string_view TOKEN_CONDITION = "ZMaybe"; -constexpr std::string_view TOKEN_NEGATION = "ZNot"; -constexpr std::string_view TOKEN_REGEX = "ZRegex"; +constexpr std::string_view TOKEN_INDEX = "ZIndex"; constexpr auto ASCII_MAX = static_cast(0x80); @@ -152,69 +146,22 @@ inline auto encode_string_or_empty(std::ostringstream &output, } } -class TokenVisitor { -public: - explicit TokenVisitor(std::ostringstream &output) noexcept - : output_{output} {} - - auto operator()(const sourcemeta::core::Pointer::Token &token) const noexcept - -> void { - this->output_ << SEPARATOR; - encode_string_or_empty(this->output_, token.to_property()); - } - - auto operator()(const sourcemeta::core::PointerTemplate::Wildcard &wildcard) - const noexcept -> void { - this->output_ << SEPARATOR; - switch (wildcard) { - case sourcemeta::core::PointerTemplate::Wildcard::Property: - this->output_ << TOKEN_WILDCARD_PROPERTY; - break; - case sourcemeta::core::PointerTemplate::Wildcard::Item: - this->output_ << TOKEN_WILDCARD_ITEM; - break; - case sourcemeta::core::PointerTemplate::Wildcard::Key: - this->output_ << TOKEN_WILDCARD_KEY; - break; - } - } - - auto operator()(const sourcemeta::core::PointerTemplate::Condition &condition) - const noexcept -> void { - this->output_ << SEPARATOR << TOKEN_CONDITION; - if (condition.suffix.has_value()) { - encode_string_or_empty(this->output_, condition.suffix.value()); - } - } - - auto - operator()(const sourcemeta::core::PointerTemplate::Negation &) const noexcept - -> void { - this->output_ << SEPARATOR << TOKEN_NEGATION; - } - - auto operator()(const sourcemeta::core::PointerTemplate::Regex ®ex) - const noexcept -> void { - this->output_ << SEPARATOR << TOKEN_REGEX; - encode_string_or_empty(this->output_, regex); - } - -private: - // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) - std::ostringstream &output_; -}; - } // namespace namespace sourcemeta::core { -auto mangle(const PointerTemplate &pointer, const std::string_view prefix) +auto mangle(const Pointer &pointer, const std::string_view prefix) -> std::string { assert(!prefix.empty()); std::ostringstream output; encode_prefix(output, prefix); for (const auto &token : pointer) { - std::visit(TokenVisitor{output}, token); + output << SEPARATOR; + if (token.is_property()) { + encode_string_or_empty(output, token.to_property()); + } else { + output << TOKEN_INDEX << token.to_index(); + } } return output.str(); } diff --git a/src/core/jsonschema/frame.cc b/src/core/jsonschema/frame.cc index 9f9bf66cc..9cfb1af53 100644 --- a/src/core/jsonschema/frame.cc +++ b/src/core/jsonschema/frame.cc @@ -219,7 +219,6 @@ auto throw_already_exists(const sourcemeta::core::JSON::String &uri) -> void { } auto store(sourcemeta::core::SchemaFrame::Locations &frame, - sourcemeta::core::SchemaFrame::Instances &instances, const sourcemeta::core::SchemaReferenceType type, const sourcemeta::core::SchemaFrame::LocationType entry_type, const sourcemeta::core::JSON::String &uri, @@ -229,7 +228,6 @@ auto store(sourcemeta::core::SchemaFrame::Locations &frame, const sourcemeta::core::Pointer &pointer_from_base, const sourcemeta::core::JSON::String &dialect, const sourcemeta::core::JSON::String &base_dialect, - std::vector instance_locations, const std::optional &parent, const bool ignore_if_present = false, const bool already_canonical = false) -> void { @@ -249,11 +247,6 @@ auto store(sourcemeta::core::SchemaFrame::Locations &frame, if (!ignore_if_present && !inserted) { throw_already_exists(canonical); } - - if (!instance_locations.empty()) { - instances.insert_or_assign(pointer_from_root, - std::move(instance_locations)); - } } // Check misunderstood struct to be a function @@ -263,114 +256,13 @@ struct InternalEntry { std::optional id; }; -auto traverse_origin_instance_locations( - const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Instances &instances, - const sourcemeta::core::Pointer ¤t, - const std::optional &accumulator, - sourcemeta::core::SchemaFrame::Instances::mapped_type &destination, - std::unordered_set< - const sourcemeta::core::SchemaFrame::References::value_type *> &visited) - -> void { - if (accumulator.has_value() && - std::ranges::find(destination, accumulator.value()) == - destination.cend()) { - destination.push_back(accumulator.value()); - } - - for (const auto &reference : frame.references_to(current)) { - if (visited.contains(&reference.get())) { - continue; - } - - visited.insert(&reference.get()); - - const auto subschema_pointer{reference.get().first.second.initial()}; - const auto match{instances.find(subschema_pointer)}; - if (match != instances.cend()) { - for (const auto &instance_location : match->second) { - traverse_origin_instance_locations(frame, instances, subschema_pointer, - instance_location, destination, - visited); - } - } else { - // Even if the parent doesn't have instance locations yet, - // recurse to find the origin of the reference chain - traverse_origin_instance_locations(frame, instances, subschema_pointer, - std::nullopt, destination, visited); - } - } -} - // Check misunderstood struct to be a function // NOLINTNEXTLINE(bugprone-exception-escape) struct CacheSubschema { - sourcemeta::core::PointerTemplate instance_location{}; - sourcemeta::core::PointerTemplate relative_instance_location{}; bool orphan{}; std::optional parent{}; }; -auto is_definition_entry(const sourcemeta::core::Pointer &pointer) -> bool { - if (pointer.size() < 2) { - return false; - } - - const auto &container{pointer.at(pointer.size() - 2)}; - return container.is_property() && (container.to_property() == "$defs" || - container.to_property() == "definitions"); -} - -auto repopulate_instance_locations( - const sourcemeta::core::SchemaFrame &frame, - const sourcemeta::core::SchemaFrame::Instances &instances, - const std::unordered_map &cache, - const sourcemeta::core::Pointer &pointer, const CacheSubschema &cache_entry, - sourcemeta::core::SchemaFrame::Instances::mapped_type &destination, - const std::optional &accumulator) - -> void { - // Definition entries should not inherit instance locations from their parent - // container. They only get instance locations if something references them. - // However, children of definitions should still inherit from their definition - // parent - if (cache_entry.orphan && is_definition_entry(pointer)) { - return; - } - - if (cache_entry.parent.has_value() && - // Don't consider bases from the root subschema, as if that - // subschema has any instance location other than "", then it - // indicates a recursive reference - !cache_entry.parent.value().empty()) { - const auto match{instances.find(cache_entry.parent.value())}; - if (match == instances.cend()) { - return; - } - - for (const auto &parent_instance_location : match->second) { - auto new_accumulator = cache_entry.relative_instance_location; - if (accumulator.has_value()) { - for (const auto &token : accumulator.value()) { - new_accumulator.emplace_back(token); - } - } - - auto result = parent_instance_location; - for (const auto &token : new_accumulator) { - result.emplace_back(token); - } - - if (std::ranges::find(destination, result) == destination.cend()) { - destination.push_back(result); - } - - repopulate_instance_locations( - frame, instances, cache, cache_entry.parent.value(), - cache.at(cache_entry.parent.value()), destination, new_accumulator); - } - } -} - } // namespace namespace sourcemeta::core { @@ -471,24 +363,6 @@ auto SchemaFrame::to_json( root.at("references").push_back(std::move(entry)); } - root.assign_assume_new("instances", JSON::make_object()); - for (const auto &instance : this->instances_) { - if (instance.second.empty()) { - continue; - } - - auto entry{JSON::make_array()}; - for (const auto &pointer : instance.second) { - // TODO: Overload .to_string() for PointerTemplate - std::ostringstream result; - sourcemeta::core::stringify(pointer, result); - entry.push_back(sourcemeta::core::to_json(result.str())); - } - - root.at("instances") - .assign_assume_new(to_string(instance.first), std::move(entry)); - } - return root; } @@ -541,19 +415,10 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, root_id.value() != default_id.value()}; if (has_explicit_different_id) { const auto default_id_canonical{URI::canonicalize(default_id.value())}; - if (this->mode_ == SchemaFrame::Mode::Instances) { - store(this->locations_, this->instances_, SchemaReferenceType::Static, - SchemaFrame::LocationType::Resource, default_id_canonical, - root_id, root_id.value(), path, sourcemeta::core::empty_pointer, - root_dialect.value(), root_base_dialect.value(), {{}}, - std::nullopt); - } else { - store(this->locations_, this->instances_, SchemaReferenceType::Static, - SchemaFrame::LocationType::Resource, default_id_canonical, - root_id, root_id.value(), path, sourcemeta::core::empty_pointer, - root_dialect.value(), root_base_dialect.value(), {}, - std::nullopt); - } + store(this->locations_, SchemaReferenceType::Static, + SchemaFrame::LocationType::Resource, default_id_canonical, root_id, + root_id.value(), path, sourcemeta::core::empty_pointer, + root_dialect.value(), root_base_dialect.value(), std::nullopt); base_uris.insert({path, {root_id.value(), default_id_canonical}}); } @@ -581,13 +446,8 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, entry.pointer.empty() ? root_id : std::nullopt)}; // Store information - subschemas.emplace( - entry.pointer, - CacheSubschema{.instance_location = entry.instance_location, - .relative_instance_location = - entry.relative_instance_location, - .orphan = entry.orphan, - .parent = entry.parent}); + subschemas.emplace(entry.pointer, CacheSubschema{.orphan = entry.orphan, + .parent = entry.parent}); subschema_entries.emplace_back( InternalEntry{.common = std::move(entry), .id = std::move(id)}); current_subschema_entries.emplace_back(subschema_entries.size() - 1); @@ -644,26 +504,12 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, maybe_match == this->locations_.cend()) { assert(entry.common.base_dialect.has_value()); - if (!(entry.common.orphan) && - this->mode_ == SchemaFrame::Mode::Instances) { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, - SchemaFrame::LocationType::Resource, new_id, root_id, - new_id, entry.common.pointer, - sourcemeta::core::empty_pointer, - entry.common.dialect.value(), - entry.common.base_dialect.value(), - {entry.common.instance_location}, entry.common.parent); - } else { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, - SchemaFrame::LocationType::Resource, new_id, root_id, - new_id, entry.common.pointer, - sourcemeta::core::empty_pointer, - entry.common.dialect.value(), - entry.common.base_dialect.value(), {}, - entry.common.parent); - } + store(this->locations_, SchemaReferenceType::Static, + SchemaFrame::LocationType::Resource, new_id, root_id, + new_id, entry.common.pointer, + sourcemeta::core::empty_pointer, + entry.common.dialect.value(), + entry.common.base_dialect.value(), entry.common.parent); } auto base_uri_match{base_uris.find(entry.common.pointer)}; @@ -712,46 +558,37 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, const auto bases{ find_nearest_bases(base_uris, entry.common.pointer, entry.id)}; - std::vector instance_locations; - if (!entry.common.orphan && - this->mode_ == SchemaFrame::Mode::Instances) { - instance_locations.push_back(entry.common.instance_location); - } - if (bases.first.empty()) { const auto anchor_uri{sourcemeta::core::URI::from_fragment(name)}; const auto relative_anchor_uri{anchor_uri.recompose()}; if (type == AnchorType::Static || type == AnchorType::All) { - store( - this->locations_, this->instances_, SchemaReferenceType::Static, - SchemaFrame::LocationType::Anchor, relative_anchor_uri, root_id, - "", entry.common.pointer, - entry.common.pointer.resolve_from(bases.second), - entry.common.dialect.value(), entry.common.base_dialect.value(), - instance_locations, entry.common.parent); + store(this->locations_, SchemaReferenceType::Static, + SchemaFrame::LocationType::Anchor, relative_anchor_uri, + root_id, "", entry.common.pointer, + entry.common.pointer.resolve_from(bases.second), + entry.common.dialect.value(), + entry.common.base_dialect.value(), entry.common.parent); } if (type == AnchorType::Dynamic || type == AnchorType::All) { - store( - this->locations_, this->instances_, - SchemaReferenceType::Dynamic, SchemaFrame::LocationType::Anchor, - relative_anchor_uri, root_id, "", entry.common.pointer, - entry.common.pointer.resolve_from(bases.second), - entry.common.dialect.value(), entry.common.base_dialect.value(), - instance_locations, entry.common.parent); + store(this->locations_, SchemaReferenceType::Dynamic, + SchemaFrame::LocationType::Anchor, relative_anchor_uri, + root_id, "", entry.common.pointer, + entry.common.pointer.resolve_from(bases.second), + entry.common.dialect.value(), + entry.common.base_dialect.value(), entry.common.parent); // Register a dynamic anchor as a static anchor if possible too if (entry.common.vocabularies.contains( Vocabularies::Known::JSON_Schema_2020_12_Core)) { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, + store(this->locations_, SchemaReferenceType::Static, SchemaFrame::LocationType::Anchor, relative_anchor_uri, root_id, "", entry.common.pointer, entry.common.pointer.resolve_from(bases.second), entry.common.dialect.value(), - entry.common.base_dialect.value(), instance_locations, - entry.common.parent, true); + entry.common.base_dialect.value(), entry.common.parent, + true); } } } else { @@ -768,37 +605,35 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, } if (type == AnchorType::Static || type == AnchorType::All) { - store(this->locations_, this->instances_, + store(this->locations_, sourcemeta::core::SchemaReferenceType::Static, SchemaFrame::LocationType::Anchor, anchor_uri, root_id, base_string, entry.common.pointer, entry.common.pointer.resolve_from(bases.second), entry.common.dialect.value(), - entry.common.base_dialect.value(), instance_locations, - entry.common.parent); + entry.common.base_dialect.value(), entry.common.parent); } if (type == AnchorType::Dynamic || type == AnchorType::All) { - store(this->locations_, this->instances_, + store(this->locations_, sourcemeta::core::SchemaReferenceType::Dynamic, SchemaFrame::LocationType::Anchor, anchor_uri, root_id, base_string, entry.common.pointer, entry.common.pointer.resolve_from(bases.second), entry.common.dialect.value(), - entry.common.base_dialect.value(), instance_locations, - entry.common.parent); + entry.common.base_dialect.value(), entry.common.parent); // Register a dynamic anchor as a static anchor if possible too if (entry.common.vocabularies.contains( Vocabularies::Known::JSON_Schema_2020_12_Core)) { - store(this->locations_, this->instances_, + store(this->locations_, sourcemeta::core::SchemaReferenceType::Static, SchemaFrame::LocationType::Anchor, anchor_uri, root_id, base_string, entry.common.pointer, entry.common.pointer.resolve_from(bases.second), entry.common.dialect.value(), - entry.common.base_dialect.value(), instance_locations, - entry.common.parent, true); + entry.common.base_dialect.value(), entry.common.parent, + true); } } @@ -856,34 +691,19 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, const auto subschema{subschemas.find(pointer)}; if (subschema != subschemas.cend()) { - // Handle orphan schemas - if (!(subschema->second.orphan) && - this->mode_ == SchemaFrame::Mode::Instances) { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, - SchemaFrame::LocationType::Subschema, result, root_id, - current_base, pointer, - pointer.resolve_from(nearest_bases.second), - dialects.first.front(), current_base_dialect, - {subschema->second.instance_location}, - subschema->second.parent, false, true); - } else { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, - SchemaFrame::LocationType::Subschema, result, root_id, - current_base, pointer, - pointer.resolve_from(nearest_bases.second), - dialects.first.front(), current_base_dialect, {}, - subschema->second.parent, false, true); - } + store(this->locations_, SchemaReferenceType::Static, + SchemaFrame::LocationType::Subschema, result, root_id, + current_base, pointer, + pointer.resolve_from(nearest_bases.second), + dialects.first.front(), current_base_dialect, + subschema->second.parent, false, true); } else { - store(this->locations_, this->instances_, - SchemaReferenceType::Static, + store(this->locations_, SchemaReferenceType::Static, SchemaFrame::LocationType::Pointer, result, root_id, current_base, pointer, pointer.resolve_from(nearest_bases.second), - dialects.first.front(), current_base_dialect, {}, - dialects.second, false, true); + dialects.first.front(), current_base_dialect, dialects.second, + false, true); } } } @@ -1055,49 +875,6 @@ auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker, this->references_.emplace(std::move(entry)); } } - - if (this->mode_ == sourcemeta::core::SchemaFrame::Mode::Instances) { - // First pass: trace through references to find instance locations. - // This handles definitions that are referenced - for (auto &entry : this->locations_) { - if (entry.second.type == SchemaFrame::LocationType::Pointer) { - continue; - } - - std::unordered_set visited; - traverse_origin_instance_locations( - *this, this->instances_, entry.second.pointer, std::nullopt, - this->instances_[entry.second.pointer], visited); - } - - // Second pass: inherit instance locations from parents (top-down). - // This handles applicator children inheriting from their parent schema - for (auto &entry : this->locations_) { - if (entry.second.type == SchemaFrame::LocationType::Pointer) { - continue; - } - - const auto subschema{subschemas.find(entry.second.pointer)}; - repopulate_instance_locations(*this, this->instances_, subschemas, - subschema->first, subschema->second, - this->instances_[entry.second.pointer], - std::nullopt); - } - - // Third pass: trace references again. Now that inheritance has run, - // schemas from definitions can trace to applicator children that now have - // instance locations from inheritance - for (auto &entry : this->locations_) { - if (entry.second.type == SchemaFrame::LocationType::Pointer) { - continue; - } - - std::unordered_set visited; - traverse_origin_instance_locations( - *this, this->instances_, entry.second.pointer, std::nullopt, - this->instances_[entry.second.pointer], visited); - } - } } auto SchemaFrame::locations() const noexcept -> const Locations & { @@ -1210,17 +987,6 @@ auto SchemaFrame::dereference(const Location &location, return {SchemaReferenceType::Static, destination->second}; } -auto SchemaFrame::instance_locations(const Location &location) const -> const - typename Instances::mapped_type & { - const auto match{this->instances_.find(location.pointer)}; - if (match == this->instances_.cend()) { - static const typename Instances::mapped_type fallback; - return fallback; - } - - return match->second; -} - auto SchemaFrame::references_to(const Pointer &pointer) const -> std::vector< std::reference_wrapper> { std::vector> diff --git a/src/core/jsonschema/include/sourcemeta/core/jsonschema_frame.h b/src/core/jsonschema/include/sourcemeta/core/jsonschema_frame.h index df9333269..ed2ac645c 100644 --- a/src/core/jsonschema/include/sourcemeta/core/jsonschema_frame.h +++ b/src/core/jsonschema/include/sourcemeta/core/jsonschema_frame.h @@ -104,7 +104,7 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaFrame { public: /// The mode of framing. More extensive analysis can be compute and memory /// intensive - enum class Mode : std::uint8_t { Locations, References, Instances }; + enum class Mode : std::uint8_t { Locations, References }; SchemaFrame(const Mode mode) : mode_{mode} {} @@ -176,10 +176,6 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaFrame { // point to different places. std::map, Location>; - // TODO: Turn the mapped value into a proper set - /// A set of unresolved instance locations - using Instances = std::map>; - /// A set of paths to frame within a schema wrapper using Paths = std::set; @@ -237,10 +233,6 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaFrame { -> std::pair>>; - /// Get the unresolved instance locations associated with a location entry - [[nodiscard]] auto instance_locations(const Location &location) const -> const - typename Instances::mapped_type &; - /// Find all references to a given location pointer [[nodiscard]] auto references_to(const Pointer &pointer) const -> std::vector< std::reference_wrapper>; @@ -255,7 +247,6 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaFrame { #endif Locations locations_; References references_; - Instances instances_; #if defined(_MSC_VER) #pragma warning(default : 4251 4275) #endif diff --git a/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h b/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h index 8f2845bc1..4267240ee 100644 --- a/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h +++ b/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h @@ -214,14 +214,6 @@ struct SchemaIteratorEntry { // TODO: Use "known" enum classes for base dialects std::optional base_dialect; std::reference_wrapper subschema; - - // TODO: These two pointer templates contain some overlap. - // Instead, have a `base_instance_location` and a `relative_instance_location` - // that when concatenated, represent the full `instance_location` - // TODO: Make these WeakPointerTemplate - PointerTemplate instance_location; - PointerTemplate relative_instance_location; - bool orphan; }; diff --git a/src/core/jsonschema/walker.cc b/src/core/jsonschema/walker.cc index 673532244..787069556 100644 --- a/src/core/jsonschema/walker.cc +++ b/src/core/jsonschema/walker.cc @@ -23,8 +23,6 @@ auto ref_overrides_adjacent_keywords(const std::string &base_dialect) -> bool { auto walk(const std::optional &parent, const sourcemeta::core::Pointer &pointer, - const sourcemeta::core::PointerTemplate &instance_location, - const sourcemeta::core::PointerTemplate &relative_instance_location, std::vector &subschemas, const sourcemeta::core::JSON &subschema, const sourcemeta::core::SchemaWalker &walker, @@ -77,16 +75,14 @@ auto walk(const std::optional &parent, resolver, current_base_dialect, current_dialect)}; if (type == SchemaWalkerType_t::Deep || level > 0) { - sourcemeta::core::SchemaIteratorEntry entry{ - .parent = parent, - .pointer = pointer, - .dialect = current_dialect, - .vocabularies = vocabularies, - .base_dialect = current_base_dialect, - .subschema = subschema, - .instance_location = instance_location, - .relative_instance_location = relative_instance_location, - .orphan = orphan}; + sourcemeta::core::SchemaIteratorEntry entry{.parent = parent, + .pointer = pointer, + .dialect = current_dialect, + .vocabularies = vocabularies, + .base_dialect = + current_base_dialect, + .subschema = subschema, + .orphan = orphan}; subschemas.push_back(std::move(entry)); } @@ -116,100 +112,60 @@ auto walk(const std::optional &parent, 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::Condition{pair.first}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Wildcard::Property); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}, - sourcemeta::core::PointerTemplate::Wildcard::Property}, - subschemas, pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType:: ApplicatorValueTraverseAnyPropertyKey: { 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::Wildcard::Key); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Wildcard::Key}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType:: ApplicatorValueTraverseAnyItem: { 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::Wildcard::Item); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Wildcard::Item}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, 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::Condition{pair.first}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Wildcard::Item); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}, - sourcemeta::core::PointerTemplate::Wildcard::Item}, - subschemas, pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType::ApplicatorValueTraverseParent: { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); - auto new_instance_location{instance_location}; - new_instance_location.pop_back(); - walk(pointer, new_pointer, new_instance_location, {}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlaceOther: { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); - walk(pointer, new_pointer, instance_location, {}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType::ApplicatorValueInPlaceNegate: { 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::Negation{}); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Negation{}}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, 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::Condition{pair.first}); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}}, - subschemas, pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; case sourcemeta::core::SchemaKeywordType::ApplicatorElementsTraverseItem: @@ -218,10 +174,7 @@ auto walk(const std::optional &parent, 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(new_pointer.back()); - walk(pointer, new_pointer, new_instance_location, - {new_pointer.back()}, subschemas, pair.second.at(index), + walk(pointer, new_pointer, subschemas, pair.second.at(index), walker, resolver, current_dialect, current_base_dialect, type, level + 1, orphan); } @@ -235,9 +188,9 @@ auto walk(const std::optional &parent, sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(index); - walk(pointer, new_pointer, instance_location, {}, subschemas, - pair.second.at(index), walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second.at(index), + walker, resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } @@ -249,19 +202,9 @@ auto walk(const std::optional &parent, 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::Condition{pair.first}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Condition{ - std::to_string(index)}); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}, - sourcemeta::core::PointerTemplate::Condition{ - std::to_string(index)}}, - subschemas, pair.second.at(index), walker, resolver, - current_dialect, current_base_dialect, type, level + 1, - orphan); + walk(pointer, new_pointer, subschemas, pair.second.at(index), + walker, resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } @@ -274,22 +217,9 @@ auto walk(const std::optional &parent, 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::Condition{pair.first}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Condition{ - std::to_string(index)}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Negation{}); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}, - sourcemeta::core::PointerTemplate::Condition{ - std::to_string(index)}, - sourcemeta::core::PointerTemplate::Negation{}}, - subschemas, pair.second.at(index), walker, resolver, - current_dialect, current_base_dialect, type, level + 1, - orphan); + walk(pointer, new_pointer, subschemas, pair.second.at(index), + walker, resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } @@ -302,10 +232,7 @@ auto walk(const std::optional &parent, sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(subpair.first); - auto new_instance_location{instance_location}; - new_instance_location.emplace_back(new_pointer.back()); - walk(pointer, new_pointer, new_instance_location, - {new_pointer.back()}, subschemas, subpair.second, walker, + walk(pointer, new_pointer, subschemas, subpair.second, walker, resolver, current_dialect, current_base_dialect, type, level + 1, orphan); } @@ -320,11 +247,9 @@ auto walk(const std::optional &parent, sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(subpair.first); - auto new_instance_location{instance_location}; - new_instance_location.emplace_back(subpair.first); - walk(pointer, new_pointer, new_instance_location, {subpair.first}, - subschemas, subpair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, subpair.second, walker, + resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } @@ -336,16 +261,9 @@ auto walk(const std::optional &parent, sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(subpair.first); - auto new_instance_location{instance_location}; - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Condition{pair.first}); - new_instance_location.emplace_back( - sourcemeta::core::PointerTemplate::Condition{subpair.first}); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Condition{pair.first}, - sourcemeta::core::PointerTemplate::Condition{subpair.first}}, - subschemas, subpair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, subpair.second, walker, + resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } @@ -357,9 +275,9 @@ auto walk(const std::optional &parent, 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, - subpair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, true); + walk(pointer, new_pointer, subschemas, subpair.second, walker, + resolver, current_dialect, current_base_dialect, type, + level + 1, true); } } @@ -372,23 +290,15 @@ auto walk(const std::optional &parent, 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(new_pointer.back()); - walk(pointer, new_pointer, new_instance_location, - {new_pointer.back()}, subschemas, pair.second.at(index), + walk(pointer, new_pointer, subschemas, pair.second.at(index), walker, resolver, current_dialect, current_base_dialect, type, level + 1, orphan); } } else { 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::Wildcard::Item); - walk(pointer, new_pointer, new_instance_location, - {sourcemeta::core::PointerTemplate::Wildcard::Item}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; @@ -400,16 +310,15 @@ auto walk(const std::optional &parent, sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); new_pointer.emplace_back(index); - walk(pointer, new_pointer, instance_location, {}, subschemas, - pair.second.at(index), walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second.at(index), + walker, resolver, current_dialect, current_base_dialect, type, + level + 1, orphan); } } else { sourcemeta::core::Pointer new_pointer{pointer}; new_pointer.emplace_back(pair.first); - walk(pointer, new_pointer, instance_location, {}, subschemas, - pair.second, walker, resolver, current_dialect, - current_base_dialect, type, level + 1, orphan); + walk(pointer, new_pointer, subschemas, pair.second, walker, resolver, + current_dialect, current_base_dialect, type, level + 1, orphan); } break; @@ -437,31 +346,25 @@ sourcemeta::core::SchemaIterator::SchemaIterator( sourcemeta::core::dialect(schema, default_dialect)}; sourcemeta::core::Pointer pointer; - sourcemeta::core::PointerTemplate instance_location; // If the given schema declares no dialect and the user didn't // not pass a default, then there is nothing we can do. We know // the current schema is a subschema, but cannot walk any further. if (!dialect.has_value()) { - sourcemeta::core::SchemaIteratorEntry entry{ - .parent = std::nullopt, - .pointer = pointer, - .dialect = std::nullopt, - .vocabularies = {}, - .base_dialect = std::nullopt, - .subschema = schema, - // TODO: Only compute these if needed, i.e. when framing with instance - // locations - .instance_location = instance_location, - .relative_instance_location = instance_location, - .orphan = false}; + sourcemeta::core::SchemaIteratorEntry entry{.parent = std::nullopt, + .pointer = pointer, + .dialect = std::nullopt, + .vocabularies = {}, + .base_dialect = std::nullopt, + .subschema = schema, + .orphan = false}; this->subschemas.push_back(std::move(entry)); } else { const auto base_dialect{ sourcemeta::core::base_dialect(schema, resolver, dialect)}; assert(base_dialect.has_value()); - walk(std::nullopt, pointer, instance_location, instance_location, - this->subschemas, schema, walker, resolver, dialect.value(), - base_dialect.value(), SchemaWalkerType_t::Deep, 0, false); + walk(std::nullopt, pointer, this->subschemas, schema, walker, resolver, + dialect.value(), base_dialect.value(), SchemaWalkerType_t::Deep, 0, + false); } } @@ -474,13 +377,12 @@ sourcemeta::core::SchemaIteratorFlat::SchemaIteratorFlat( sourcemeta::core::dialect(schema, default_dialect)}; if (dialect.has_value()) { sourcemeta::core::Pointer pointer; - sourcemeta::core::PointerTemplate instance_location; const auto base_dialect{ sourcemeta::core::base_dialect(schema, resolver, dialect)}; assert(base_dialect.has_value()); - walk(std::nullopt, pointer, instance_location, instance_location, - this->subschemas, schema, walker, resolver, dialect.value(), - base_dialect.value(), SchemaWalkerType_t::Flat, 0, false); + walk(std::nullopt, pointer, this->subschemas, schema, walker, resolver, + dialect.value(), base_dialect.value(), SchemaWalkerType_t::Flat, 0, + false); } } @@ -513,10 +415,6 @@ sourcemeta::core::SchemaKeywordIterator::SchemaKeywordIterator( .vocabularies = vocabularies, .base_dialect = base_dialect, .subschema = entry.second, - // TODO: Only compute these if needed, i.e. when framing with instance - // locations - .instance_location = {}, - .relative_instance_location = {}, .orphan = false}; this->entries.push_back(std::move(subschema_entry)); } diff --git a/test/jsonpointer/CMakeLists.txt b/test/jsonpointer/CMakeLists.txt index 0462f8761..53ee4fbbc 100644 --- a/test/jsonpointer/CMakeLists.txt +++ b/test/jsonpointer/CMakeLists.txt @@ -9,7 +9,6 @@ sourcemeta_googletest(NAMESPACE sourcemeta PROJECT core NAME jsonpointer jsonpointer_parse_test.cc jsonpointer_pointer_test.cc jsonpointer_position_test.cc - jsonpointer_template_test.cc jsonpointer_weakpointer_test.cc jsonpointer_resolve_from_test.cc jsonpointer_set_test.cc diff --git a/test/jsonpointer/jsonpointer_mangle_test.cc b/test/jsonpointer/jsonpointer_mangle_test.cc index bfbb0b8e3..6ed9b1d6c 100644 --- a/test/jsonpointer/jsonpointer_mangle_test.cc +++ b/test/jsonpointer/jsonpointer_mangle_test.cc @@ -3,545 +3,474 @@ #include TEST(JSONPointer_mangle, empty_pointer_lowercase_prefix) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema"); } TEST(JSONPointer_mangle, empty_pointer_uppercase_prefix) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "Schema")}; EXPECT_EQ(result, "Schema"); } TEST(JSONPointer_mangle, empty_pointer_custom_prefix) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "myNamespace")}; EXPECT_EQ(result, "MyNamespace"); } TEST(JSONPointer_mangle, single_lowercase_token) { - const sourcemeta::core::PointerTemplate pointer{"foo"}; + const sourcemeta::core::Pointer pointer{"foo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo"); } TEST(JSONPointer_mangle, single_lowercase_token_long) { - const sourcemeta::core::PointerTemplate pointer{"foobar"}; + const sourcemeta::core::Pointer pointer{"foobar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foobar"); } TEST(JSONPointer_mangle, single_uppercase_token) { - const sourcemeta::core::PointerTemplate pointer{"Foo"}; + const sourcemeta::core::Pointer pointer{"Foo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_UFoo"); } TEST(JSONPointer_mangle, single_all_uppercase_token) { - const sourcemeta::core::PointerTemplate pointer{"FOO"}; + const sourcemeta::core::Pointer pointer{"FOO"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_UFOO"); } TEST(JSONPointer_mangle, lowercase_x_at_start) { - const sourcemeta::core::PointerTemplate pointer{"xoo"}; + const sourcemeta::core::Pointer pointer{"xoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X78oo"); } TEST(JSONPointer_mangle, uppercase_X_at_start) { - const sourcemeta::core::PointerTemplate pointer{"Xoo"}; + const sourcemeta::core::Pointer pointer{"Xoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X58oo"); } TEST(JSONPointer_mangle, lowercase_u_at_start) { - const sourcemeta::core::PointerTemplate pointer{"uoo"}; + const sourcemeta::core::Pointer pointer{"uoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X75oo"); } TEST(JSONPointer_mangle, uppercase_U_at_start) { - const sourcemeta::core::PointerTemplate pointer{"Uoo"}; + const sourcemeta::core::Pointer pointer{"Uoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X55oo"); } TEST(JSONPointer_mangle, uppercase_X_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foXbar"}; + const sourcemeta::core::Pointer pointer{"foXbar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FoX58bar"); } TEST(JSONPointer_mangle, uppercase_U_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foUbar"}; + const sourcemeta::core::Pointer pointer{"foUbar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FoX55bar"); } TEST(JSONPointer_mangle, lowercase_x_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foxbar"}; + const sourcemeta::core::Pointer pointer{"foxbar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foxbar"); } TEST(JSONPointer_mangle, lowercase_u_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foubar"}; + const sourcemeta::core::Pointer pointer{"foubar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foubar"); } TEST(JSONPointer_mangle, hyphen_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foo-bar"}; + const sourcemeta::core::Pointer pointer{"foo-bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX2DBar"); } TEST(JSONPointer_mangle, underscore_in_token) { - const sourcemeta::core::PointerTemplate pointer{"foo_bar"}; + const sourcemeta::core::Pointer pointer{"foo_bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX5FBar"); } TEST(JSONPointer_mangle, space_in_token) { - const sourcemeta::core::PointerTemplate pointer{"foo bar"}; + const sourcemeta::core::Pointer pointer{"foo bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX20Bar"); } TEST(JSONPointer_mangle, at_sign_in_token) { - const sourcemeta::core::PointerTemplate pointer{"foo@bar"}; + const sourcemeta::core::Pointer pointer{"foo@bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX40Bar"); } TEST(JSONPointer_mangle, special_char_at_start) { - const sourcemeta::core::PointerTemplate pointer{"@foo"}; + const sourcemeta::core::Pointer pointer{"@foo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X40Foo"); } TEST(JSONPointer_mangle, only_special_characters) { - const sourcemeta::core::PointerTemplate pointer{"@#$%"}; + const sourcemeta::core::Pointer pointer{"@#$%"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X40X23X24X25"); } TEST(JSONPointer_mangle, multiple_hyphens) { - const sourcemeta::core::PointerTemplate pointer{"foo--bar"}; + const sourcemeta::core::Pointer pointer{"foo--bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX2DX2DBar"); } TEST(JSONPointer_mangle, digit_at_start) { - const sourcemeta::core::PointerTemplate pointer{"123foo"}; + const sourcemeta::core::Pointer pointer{"123foo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_123foo"); } TEST(JSONPointer_mangle, only_digits) { - const sourcemeta::core::PointerTemplate pointer{"123"}; + const sourcemeta::core::Pointer pointer{"123"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_123"); } TEST(JSONPointer_mangle, digits_in_middle) { - const sourcemeta::core::PointerTemplate pointer{"foo123bar"}; + const sourcemeta::core::Pointer pointer{"foo123bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo123bar"); } TEST(JSONPointer_mangle, digits_at_end) { - const sourcemeta::core::PointerTemplate pointer{"foo123"}; + const sourcemeta::core::Pointer pointer{"foo123"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo123"); } TEST(JSONPointer_mangle, two_lowercase_tokens) { - const sourcemeta::core::PointerTemplate pointer{"foo", "bar"}; + const sourcemeta::core::Pointer pointer{"foo", "bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo_Bar"); } TEST(JSONPointer_mangle, three_lowercase_tokens) { - const sourcemeta::core::PointerTemplate pointer{"foo", "bar", "baz"}; + const sourcemeta::core::Pointer pointer{"foo", "bar", "baz"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo_Bar_Baz"); } TEST(JSONPointer_mangle, camelcase_token) { - const sourcemeta::core::PointerTemplate pointer{"fooBar"}; + const sourcemeta::core::Pointer pointer{"fooBar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooBar"); } TEST(JSONPointer_mangle, mixed_case_multi_token) { - const sourcemeta::core::PointerTemplate pointer{"foo", "Bar"}; + const sourcemeta::core::Pointer pointer{"foo", "Bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo_UBar"); } TEST(JSONPointer_mangle, lowercase_x_followed_by_digits) { - const sourcemeta::core::PointerTemplate pointer{"x40"}; + const sourcemeta::core::Pointer pointer{"x40"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X7840"); } TEST(JSONPointer_mangle, uppercase_X_followed_by_digits) { - const sourcemeta::core::PointerTemplate pointer{"X40"}; + const sourcemeta::core::Pointer pointer{"X40"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X5840"); } TEST(JSONPointer_mangle, lowercase_u_followed_by_uppercase) { - const sourcemeta::core::PointerTemplate pointer{"uFoo"}; + const sourcemeta::core::Pointer pointer{"uFoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X75Foo"); } TEST(JSONPointer_mangle, uppercase_U_followed_by_uppercase) { - const sourcemeta::core::PointerTemplate pointer{"UFoo"}; + const sourcemeta::core::Pointer pointer{"UFoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X55Foo"); } TEST(JSONPointer_mangle, empty_token) { - const sourcemeta::core::PointerTemplate pointer{""}; + const sourcemeta::core::Pointer pointer{""}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_ZEmpty"); } TEST(JSONPointer_mangle, empty_token_then_property) { - const sourcemeta::core::PointerTemplate pointer{"", "foo"}; + const sourcemeta::core::Pointer pointer{"", "foo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_ZEmpty_Foo"); } TEST(JSONPointer_mangle, property_then_empty_token) { - const sourcemeta::core::PointerTemplate pointer{"foo", ""}; + const sourcemeta::core::Pointer pointer{"foo", ""}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_Foo_ZEmpty"); } TEST(JSONPointer_mangle, property_ZEmpty_escaped) { - const sourcemeta::core::PointerTemplate pointer{"ZEmpty"}; + const sourcemeta::core::Pointer pointer{"ZEmpty"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X5AEmpty"); } TEST(JSONPointer_mangle, deeply_nested_path) { - const sourcemeta::core::PointerTemplate pointer{"a", "b", "c", "d", "e"}; + const sourcemeta::core::Pointer pointer{"a", "b", "c", "d", "e"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_A_B_C_D_E"); } TEST(JSONPointer_mangle, preserves_case_after_first_letter) { - const sourcemeta::core::PointerTemplate pointer{"fooBAR"}; + const sourcemeta::core::Pointer pointer{"fooBAR"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooBAR"); } -TEST(JSONPointer_mangle, wildcard_property) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZAnyProperty"); -} - -TEST(JSONPointer_mangle, wildcard_item) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZAnyItem"); -} - -TEST(JSONPointer_mangle, wildcard_key) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Key}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZAnyKey"); -} - -TEST(JSONPointer_mangle, condition_without_suffix) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Condition{}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZMaybe"); -} - -TEST(JSONPointer_mangle, condition_with_suffix) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Condition{"then"}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZMaybeThen"); -} - -TEST(JSONPointer_mangle, condition_with_uppercase_suffix) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Condition{"Then"}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZMaybeUThen"); -} - -TEST(JSONPointer_mangle, condition_with_empty_suffix) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Condition{""}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZMaybeZEmpty"); -} - -TEST(JSONPointer_mangle, negation) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Negation{}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZNot"); -} - -TEST(JSONPointer_mangle, regex_simple) { - const sourcemeta::core::PointerTemplate pointer{std::string{"foo"}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZRegexFoo"); -} - -TEST(JSONPointer_mangle, regex_empty) { - const sourcemeta::core::PointerTemplate pointer{std::string{""}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZRegexZEmpty"); -} - -TEST(JSONPointer_mangle, regex_with_special_chars) { - const sourcemeta::core::PointerTemplate pointer{std::string{"^foo.*"}}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZRegexX5EFooX2EX2A"); -} - -TEST(JSONPointer_mangle, property_then_wildcard) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_Foo_ZAnyProperty"); -} - -TEST(JSONPointer_mangle, wildcard_then_property) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZAnyProperty_Foo"); -} - -TEST(JSONPointer_mangle, property_wildcard_property) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"bar"}); - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_Foo_ZAnyProperty_Bar"); -} - -TEST(JSONPointer_mangle, condition_then_property) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Condition{"if"}); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZMaybeIf_Foo"); -} - -TEST(JSONPointer_mangle, negation_then_property) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_ZNot_Foo"); -} - TEST(JSONPointer_mangle, lowercase_z_at_start) { - const sourcemeta::core::PointerTemplate pointer{"zoo"}; + const sourcemeta::core::Pointer pointer{"zoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X7Aoo"); } TEST(JSONPointer_mangle, uppercase_Z_at_start) { - const sourcemeta::core::PointerTemplate pointer{"Zoo"}; + const sourcemeta::core::Pointer pointer{"Zoo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X5Aoo"); } -TEST(JSONPointer_mangle, property_not_vs_negation_token) { - const sourcemeta::core::PointerTemplate pointer{"not"}; +TEST(JSONPointer_mangle, property_ZIndex_escaped) { + const sourcemeta::core::Pointer pointer{"ZIndex"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_Not"); -} - -TEST(JSONPointer_mangle, property_ZNot_escaped) { - const sourcemeta::core::PointerTemplate pointer{"ZNot"}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_X5ANot"); -} - -TEST(JSONPointer_mangle, property_AnyProperty_vs_wildcard) { - const sourcemeta::core::PointerTemplate pointer{"AnyProperty"}; - const auto result{sourcemeta::core::mangle(pointer, "schema")}; - EXPECT_EQ(result, "Schema_UAnyProperty"); + EXPECT_EQ(result, "Schema_X5AIndex"); } TEST(JSONPointer_mangle, unicode_single_char) { - const sourcemeta::core::PointerTemplate pointer{"föo"}; + const sourcemeta::core::Pointer pointer{"föo"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FXC3XB6o"); } TEST(JSONPointer_mangle, unicode_start) { - const sourcemeta::core::PointerTemplate pointer{"über"}; + const sourcemeta::core::Pointer pointer{"über"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XC3XBCber"); } TEST(JSONPointer_mangle, unicode_emoji) { - const sourcemeta::core::PointerTemplate pointer{"foo🎉bar"}; + const sourcemeta::core::Pointer pointer{"foo🎉bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooXF0X9FX8EX89bar"); } TEST(JSONPointer_mangle, unicode_chinese) { - const sourcemeta::core::PointerTemplate pointer{"名前"}; + const sourcemeta::core::Pointer pointer{"名前"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XE5X90X8DXE5X89X8D"); } TEST(JSONPointer_mangle, prefix_with_spaces) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "my schema")}; EXPECT_EQ(result, "MyX20Schema"); } TEST(JSONPointer_mangle, prefix_only_spaces) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, " ")}; EXPECT_EQ(result, "X20X20X20"); } TEST(JSONPointer_mangle, prefix_unicode) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "schéma")}; EXPECT_EQ(result, "SchXC3XA9Ma"); } TEST(JSONPointer_mangle, prefix_unicode_start) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "über")}; EXPECT_EQ(result, "XC3XBCBer"); } TEST(JSONPointer_mangle, prefix_emoji) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "schema🎉")}; EXPECT_EQ(result, "SchemaXF0X9FX8EX89"); } TEST(JSONPointer_mangle, prefix_uppercase) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "Schema")}; EXPECT_EQ(result, "Schema"); } TEST(JSONPointer_mangle, prefix_all_uppercase) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "SCHEMA")}; EXPECT_EQ(result, "SCHEMA"); } TEST(JSONPointer_mangle, prefix_with_digits) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "schema123")}; EXPECT_EQ(result, "Schema123"); } TEST(JSONPointer_mangle, prefix_starts_with_digit) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "123schema")}; EXPECT_EQ(result, "_123schema"); } TEST(JSONPointer_mangle, prefix_with_underscore) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "my_schema")}; EXPECT_EQ(result, "MySchema"); } TEST(JSONPointer_mangle, prefix_with_hyphen) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "my-schema")}; EXPECT_EQ(result, "MySchema"); } TEST(JSONPointer_mangle, prefix_special_chars) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "foo@bar")}; EXPECT_EQ(result, "FooX40Bar"); } TEST(JSONPointer_mangle, prefix_with_tab) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "foo\tbar")}; EXPECT_EQ(result, "FooX09Bar"); } TEST(JSONPointer_mangle, prefix_with_newline) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const auto result{sourcemeta::core::mangle(pointer, "foo\nbar")}; EXPECT_EQ(result, "FooX0ABar"); } TEST(JSONPointer_mangle, prefix_with_null_byte) { - const sourcemeta::core::PointerTemplate pointer; + const sourcemeta::core::Pointer pointer; const std::string prefix{"foo\0bar", 7}; const auto result{sourcemeta::core::mangle(pointer, prefix)}; EXPECT_EQ(result, "FooX00Bar"); } TEST(JSONPointer_mangle, utf8_does_not_start_segment) { - const sourcemeta::core::PointerTemplate pointer{"ébar"}; + const sourcemeta::core::Pointer pointer{"ébar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XC3XA9bar"); } TEST(JSONPointer_mangle, utf8_multibyte_preserves_continuity) { - const sourcemeta::core::PointerTemplate pointer{"日test"}; + const sourcemeta::core::Pointer pointer{"日test"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XE6X97XA5test"); } TEST(JSONPointer_mangle, ascii_special_starts_new_segment) { - const sourcemeta::core::PointerTemplate pointer{"foo bar"}; + const sourcemeta::core::Pointer pointer{"foo bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_FooX20Bar"); } TEST(JSONPointer_mangle, mixed_utf8_and_ascii_special) { - const sourcemeta::core::PointerTemplate pointer{"é bar"}; + const sourcemeta::core::Pointer pointer{"é bar"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XC3XA9X20Bar"); } TEST(JSONPointer_mangle, high_byte_always_escaped) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"\x80test"}); + sourcemeta::core::Pointer pointer; + pointer.emplace_back("\x80test"); const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_X80test"); } TEST(JSONPointer_mangle, latin1_supplement_escaped) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"\xA9test"}); + sourcemeta::core::Pointer pointer; + pointer.emplace_back("\xA9test"); const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XA9test"); } TEST(JSONPointer_mangle, consecutive_utf8_chars) { - const sourcemeta::core::PointerTemplate pointer{"日本"}; + const sourcemeta::core::Pointer pointer{"日本"}; const auto result{sourcemeta::core::mangle(pointer, "schema")}; EXPECT_EQ(result, "Schema_XE6X97XA5XE6X9CXAC"); } + +TEST(JSONPointer_mangle, single_index_zero) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back(0); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_ZIndex0"); +} + +TEST(JSONPointer_mangle, single_index_nonzero) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back(5); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_ZIndex5"); +} + +TEST(JSONPointer_mangle, single_index_large) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back(12345); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_ZIndex12345"); +} + +TEST(JSONPointer_mangle, property_then_index) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back("foo"); + pointer.emplace_back(0); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_Foo_ZIndex0"); +} + +TEST(JSONPointer_mangle, index_then_property) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back(0); + pointer.emplace_back("foo"); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_ZIndex0_Foo"); +} + +TEST(JSONPointer_mangle, multiple_indexes) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back(0); + pointer.emplace_back(1); + pointer.emplace_back(2); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_ZIndex0_ZIndex1_ZIndex2"); +} + +TEST(JSONPointer_mangle, mixed_property_and_index) { + sourcemeta::core::Pointer pointer; + pointer.emplace_back("items"); + pointer.emplace_back(0); + pointer.emplace_back("properties"); + pointer.emplace_back("name"); + const auto result{sourcemeta::core::mangle(pointer, "schema")}; + EXPECT_EQ(result, "Schema_Items_ZIndex0_Properties_Name"); +} diff --git a/test/jsonpointer/jsonpointer_template_test.cc b/test/jsonpointer/jsonpointer_template_test.cc deleted file mode 100644 index f76ea2040..000000000 --- a/test/jsonpointer/jsonpointer_template_test.cc +++ /dev/null @@ -1,940 +0,0 @@ -#include - -#include - -#include -#include -#include - -static_assert( - !std::is_constructible_v, - "PointerTemplate should not be constructible from nullptr"); - -TEST(JSONPointer_template, equality_without_wildcard_true) { - const sourcemeta::core::Pointer pointer{"foo", "bar"}; - const sourcemeta::core::PointerTemplate left{pointer}; - const sourcemeta::core::PointerTemplate right{pointer}; - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_without_wildcard_false) { - const sourcemeta::core::Pointer pointer_left{"foo", "bar"}; - const sourcemeta::core::Pointer pointer_right{"foo", "baz"}; - const sourcemeta::core::PointerTemplate left{pointer_left}; - const sourcemeta::core::PointerTemplate right{pointer_right}; - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_property_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - right.push_back(suffix); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_property_wildcard_false) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.push_back(suffix); - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_regex_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^@"}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^@"}); - right.push_back(suffix); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_regex_wildcard_false) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^@"}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.push_back(suffix); - right.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^@"}); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_item_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - right.push_back(suffix); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_item_wildcard_false) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.push_back(suffix); - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_key_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_key_wildcard_false) { - const sourcemeta::core::Pointer prefix_1{"foo"}; - const sourcemeta::core::Pointer prefix_2{"bar"}; - - sourcemeta::core::PointerTemplate left{prefix_1}; - left.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - - sourcemeta::core::PointerTemplate right{prefix_2}; - right.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_condition_suffix_true) { - sourcemeta::core::PointerTemplate left; - left.emplace_back(sourcemeta::core::PointerTemplate::Condition{"foo"}); - - sourcemeta::core::PointerTemplate right; - right.emplace_back(sourcemeta::core::PointerTemplate::Condition{"foo"}); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_condition_suffix_false) { - sourcemeta::core::PointerTemplate left; - left.emplace_back(sourcemeta::core::PointerTemplate::Condition{"foo"}); - - sourcemeta::core::PointerTemplate right; - right.emplace_back(sourcemeta::core::PointerTemplate::Condition{"bar"}); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_condition_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - right.push_back(suffix); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_condition_wildcard_false) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.push_back(suffix); - right.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, equality_with_negation_wildcard_true) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - right.push_back(suffix); - - EXPECT_EQ(left, right); -} - -TEST(JSONPointer_template, equality_with_negation_wildcard_false) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate left{prefix}; - left.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - left.push_back(suffix); - - sourcemeta::core::PointerTemplate right{prefix}; - right.push_back(suffix); - right.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - - EXPECT_NE(left, right); -} - -TEST(JSONPointer_template, trivial_empty) { - // const sourcemeta::core::PointerTemplate left{ - // sourcemeta::core::PointerTemplate::Negation{}}; - const sourcemeta::core::PointerTemplate pointer; - EXPECT_TRUE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_wildcard_property) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_wildcard_item) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_wildcard_key) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Wildcard::Key}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_condition) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Condition{}}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_negation) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Negation{}}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_regex) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::PointerTemplate::Regex{"^f"}}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_token_index) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::Pointer::Token{5}}; - EXPECT_TRUE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_token_property) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::Pointer::Token{"foo"}}; - EXPECT_TRUE(pointer.trivial()); -} - -TEST(JSONPointer_template, trivial_mixed) { - const sourcemeta::core::PointerTemplate pointer{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::PointerTemplate::Condition{}}; - EXPECT_FALSE(pointer.trivial()); -} - -TEST(JSONPointer_template, pop_back) { - const sourcemeta::core::Pointer base{"foo", "bar"}; - sourcemeta::core::PointerTemplate pointer{base}; - pointer.pop_back(); - - const sourcemeta::core::Pointer expected_base{"foo"}; - const sourcemeta::core::PointerTemplate expected_pointer{expected_base}; - - EXPECT_EQ(pointer, expected_pointer); -} - -TEST(JSONPointer_template, stringify_multiple_property_wildcards) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - pointer.push_back(suffix); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~P~/baz/~P~"); -} - -TEST(JSONPointer_template, stringify_multiple_regex_wildcards) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^@"}); - pointer.push_back(suffix); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Regex{"[0-9]+"}); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~R^@~/baz/~R[0-9]+~"); -} - -TEST(JSONPointer_template, stringify_multiple_item_wildcards) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - const sourcemeta::core::Pointer suffix{"baz"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - pointer.push_back(suffix); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~I~/baz/~I~"); -} - -TEST(JSONPointer_template, stringify_key_wildcard) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~K~"); -} - -TEST(JSONPointer_template, stringify_condition) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~?~"); -} - -TEST(JSONPointer_template, stringify_condition_with_suffix) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Condition{"hello"}); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~?hello~"); -} - -TEST(JSONPointer_template, stringify_negation) { - const sourcemeta::core::Pointer prefix{"foo", "bar"}; - - sourcemeta::core::PointerTemplate pointer{prefix}; - pointer.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - - std::ostringstream stream; - sourcemeta::core::stringify(pointer, stream); - - EXPECT_EQ(stream.str(), "/foo/bar/~!~"); -} - -TEST(JSONPointer_template, concat_move) { - const sourcemeta::core::Pointer pointer_left{"foo"}; - const sourcemeta::core::Pointer pointer_right{"bar", "baz"}; - const sourcemeta::core::Pointer pointer_expected{"foo", "bar", "baz"}; - - const sourcemeta::core::PointerTemplate left{pointer_left}; - sourcemeta::core::PointerTemplate right{pointer_right}; - const sourcemeta::core::PointerTemplate expected{pointer_expected}; - - const auto result{left.concat(std::move(right))}; - - EXPECT_EQ(result, expected); -} - -TEST(JSONPointer_template, empty_true) { - const sourcemeta::core::PointerTemplate pointer; - EXPECT_TRUE(pointer.empty()); -} - -TEST(JSONPointer_template, empty_false) { - const sourcemeta::core::Pointer base{"foo"}; - const sourcemeta::core::PointerTemplate pointer{base}; - EXPECT_FALSE(pointer.empty()); -} - -TEST(JSONPointer_template, construct_single_property) { - const sourcemeta::core::PointerTemplate pointer{"foo"}; - EXPECT_EQ(pointer.size(), 1); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/foo"); -} - -TEST(JSONPointer_template, construct_multiple_properties) { - const sourcemeta::core::PointerTemplate pointer{"foo", "bar", "baz"}; - EXPECT_EQ(pointer.size(), 3); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/foo/bar/baz"); -} - -TEST(JSONPointer_template, construct_single_index) { - const sourcemeta::core::PointerTemplate pointer{0}; - EXPECT_EQ(pointer.size(), 1); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/0"); -} - -TEST(JSONPointer_template, construct_multiple_indexes) { - const sourcemeta::core::PointerTemplate pointer{0, 1, 2}; - EXPECT_EQ(pointer.size(), 3); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/0/1/2"); -} - -TEST(JSONPointer_template, construct_mixed_property_index) { - const sourcemeta::core::PointerTemplate pointer{"foo", 1, "bar"}; - EXPECT_EQ(pointer.size(), 3); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/foo/1/bar"); -} - -TEST(JSONPointer_template, construct_mixed_index_property) { - const sourcemeta::core::PointerTemplate pointer{0, "foo", 1}; - EXPECT_EQ(pointer.size(), 3); - EXPECT_EQ(sourcemeta::core::to_string(pointer), "/0/foo/1"); -} - -TEST(JSONPointer_template, size_empty) { - const sourcemeta::core::PointerTemplate pointer; - EXPECT_EQ(pointer.size(), 0); -} - -TEST(JSONPointer_template, size_one) { - const sourcemeta::core::Pointer base{"foo"}; - const sourcemeta::core::PointerTemplate pointer{base}; - EXPECT_EQ(pointer.size(), 1); -} - -TEST(JSONPointer_template, size_multiple) { - const sourcemeta::core::Pointer base{"foo", "bar"}; - const sourcemeta::core::PointerTemplate pointer{base}; - EXPECT_EQ(pointer.size(), 2); -} - -TEST(JSONPointer_template, size_with_wildcard) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"bar"}); - EXPECT_EQ(pointer.size(), 3); -} - -TEST(JSONPointer_template, hash_unordered_set) { - std::unordered_set set; - - sourcemeta::core::PointerTemplate pointer_1; - pointer_1.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer_1.emplace_back(sourcemeta::core::Pointer::Token{"bar"}); - - sourcemeta::core::PointerTemplate pointer_2; - pointer_2.emplace_back(sourcemeta::core::Pointer::Token{"baz"}); - - set.insert(pointer_1); - set.insert(pointer_2); - - EXPECT_EQ(set.size(), 2); - EXPECT_TRUE(set.contains(pointer_1)); - EXPECT_TRUE(set.contains(pointer_2)); -} - -TEST(JSONPointer_template, hash_unordered_map) { - std::unordered_map map; - - sourcemeta::core::PointerTemplate pointer_1; - pointer_1.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - - sourcemeta::core::PointerTemplate pointer_2; - pointer_2.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - - map[pointer_1] = 1; - map[pointer_2] = 2; - - EXPECT_EQ(map.size(), 2); - EXPECT_EQ(map.at(pointer_1), 1); - EXPECT_EQ(map.at(pointer_2), 2); -} - -TEST(JSONPointer_template, hash_consistency) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - pointer.emplace_back(sourcemeta::core::Pointer::Token{0}); - - const std::hash hasher; - const auto hash_1{hasher(pointer)}; - const auto hash_2{hasher(pointer)}; - - EXPECT_EQ(hash_1, hash_2); -} - -TEST(JSONPointer_template, to_string_empty) { - const sourcemeta::core::PointerTemplate pointer; - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, ""); -} - -TEST(JSONPointer_template, to_string_single_property) { - const sourcemeta::core::Pointer base{"foo"}; - const sourcemeta::core::PointerTemplate pointer{base}; - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo"); -} - -TEST(JSONPointer_template, to_string_multiple_tokens) { - const sourcemeta::core::Pointer base{"foo", "bar"}; - const sourcemeta::core::PointerTemplate pointer{base}; - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/bar"); -} - -TEST(JSONPointer_template, to_string_with_property_wildcard) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Property); - pointer.emplace_back(sourcemeta::core::Pointer::Token{"bar"}); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~P~/bar"); -} - -TEST(JSONPointer_template, to_string_with_item_wildcard) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Item); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~I~"); -} - -TEST(JSONPointer_template, to_string_with_key_wildcard) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Wildcard::Key); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~K~"); -} - -TEST(JSONPointer_template, to_string_with_condition) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Condition{}); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~?~"); -} - -TEST(JSONPointer_template, to_string_with_negation) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Negation{}); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~!~"); -} - -TEST(JSONPointer_template, to_string_with_regex) { - sourcemeta::core::PointerTemplate pointer; - pointer.emplace_back(sourcemeta::core::Pointer::Token{"foo"}); - pointer.emplace_back(sourcemeta::core::PointerTemplate::Regex{"^bar"}); - const auto result{sourcemeta::core::to_string(pointer)}; - EXPECT_EQ(result, "/foo/~R^bar~"); -} - -TEST(JSONPointer_template, matches_empty) { - const sourcemeta::core::PointerTemplate left; - const sourcemeta::core::PointerTemplate right; - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_no_conditional_one) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{"foo"}}; - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_no_conditional_many) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::Pointer::Token{"bar"}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::Pointer::Token{"bar"}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_not_equal_no_conditional_one) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{"fo"}}; - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_not_equal_no_conditional_many) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::Pointer::Token{"bar"}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::Pointer::Token{"ba"}}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_conditional_one) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Condition{}}; - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_conditional_many) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_conditional_different) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_mix_1) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_equal_mix_2) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_not_equal_mix_1) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Condition{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard{}, - sourcemeta::core::PointerTemplate::Negation{}, - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{0}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_regex_true) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Regex{"^f"}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_regex_false) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Regex{"^b"}}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_regex_true_conditional) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::PointerTemplate::Condition{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Regex{"^f"}, - sourcemeta::core::PointerTemplate::Condition{}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_property) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_item_wildcard_property) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_key_wildcard_property) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Key}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_item_wildcard_index) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{0}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_index) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{0}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_key_wildcard_index) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{0}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Key}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_multi_token) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::Pointer::Token{"foo"}, - sourcemeta::core::Pointer::Token{"bar"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_property_conditional) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::Pointer::Token{"foo"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_regex) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Regex{"^f"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_item_wildcard_regex) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Regex{"^f"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_key_wildcard_regex) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Regex{"^f"}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Key}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_property_wildcard_negation) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Negation{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_item_wildcard_negation) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Negation{}}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::PointerTemplate::Wildcard::Item}; - - EXPECT_FALSE(left.matches(right)); - EXPECT_FALSE(right.matches(left)); -} - -TEST(JSONPointer_template, matches_conditional_property_wildcard) { - const sourcemeta::core::PointerTemplate left{ - sourcemeta::core::PointerTemplate::Condition{}, - sourcemeta::core::PointerTemplate::Wildcard::Property}; - - const sourcemeta::core::PointerTemplate right{ - sourcemeta::core::Pointer::Token{"foo"}}; - - EXPECT_TRUE(left.matches(right)); - EXPECT_TRUE(right.matches(left)); -} diff --git a/test/jsonschema/jsonschema_frame_2019_09_test.cc b/test/jsonschema/jsonschema_frame_2019_09_test.cc index 0f0d2583d..81e25370c 100644 --- a/test/jsonschema/jsonschema_frame_2019_09_test.cc +++ b/test/jsonschema/jsonschema_frame_2019_09_test.cc @@ -8,49 +8,48 @@ #define EXPECT_FRAME_STATIC_2019_09_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2019-09/schema", \ "https://json-schema.org/draft/2019-09/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2019_09_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2019-09/schema", \ "https://json-schema.org/draft/2019-09/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2019_09_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2019-09/schema", \ "https://json-schema.org/draft/2019-09/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2019-09/schema", \ "https://json-schema.org/draft/2019-09/schema", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); #define EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_DYNAMIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2019-09/schema", \ "https://json-schema.org/draft/2019-09/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_2019_09, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -59,7 +58,7 @@ TEST(JSONSchema_frame_2019_09, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -68,33 +67,29 @@ TEST(JSONSchema_frame_2019_09, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalProperties~/~P~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalProperties/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, - "/additionalProperties"); + "https://json-schema.org/draft/2019-09/schema", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalProperties~/~P~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/$id", "/additionalProperties/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, - "/additionalProperties"); + "https://json-schema.org/draft/2019-09/schema", "/additionalProperties"); // References @@ -113,7 +108,7 @@ TEST(JSONSchema_frame_2019_09, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -121,18 +116,18 @@ TEST(JSONSchema_frame_2019_09, empty_schema) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -151,7 +146,7 @@ TEST(JSONSchema_frame_2019_09, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -159,18 +154,18 @@ TEST(JSONSchema_frame_2019_09, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -193,7 +188,7 @@ TEST(JSONSchema_frame_2019_09, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -201,38 +196,38 @@ TEST(JSONSchema_frame_2019_09, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -256,7 +251,7 @@ TEST(JSONSchema_frame_2019_09, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -265,68 +260,68 @@ TEST(JSONSchema_frame_2019_09, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); // Anchors EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/test/qux#test", "https://www.sourcemeta.com/test/qux", "/properties/foo", - "https://www.sourcemeta.com/test/qux", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/test/qux", "/properties/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$id", "https://www.sourcemeta.com/test/qux", "/$id", - "https://www.sourcemeta.com/test/qux", "/$id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties", "https://www.sourcemeta.com/test/qux", "/properties", - "https://www.sourcemeta.com/test/qux", "/properties", {}, ""); + "https://www.sourcemeta.com/test/qux", "/properties", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/properties/foo", "https://www.sourcemeta.com/test/qux", "/properties/foo", - "https://www.sourcemeta.com/test/qux", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/test/qux", "/properties/foo", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties/foo/$anchor", "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", - "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", {}, + "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties/foo/type", "https://www.sourcemeta.com/test/qux", "/properties/foo/type", - "https://www.sourcemeta.com/test/qux", "/properties/foo/type", {}, + "https://www.sourcemeta.com/test/qux", "/properties/foo/type", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -349,7 +344,7 @@ TEST(JSONSchema_frame_2019_09, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -357,42 +352,42 @@ TEST(JSONSchema_frame_2019_09, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -429,7 +424,7 @@ TEST(JSONSchema_frame_2019_09, nested_schemas) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -438,138 +433,135 @@ TEST(JSONSchema_frame_2019_09, nested_schemas) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/foo#test", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/baz", "https://www.sourcemeta.com/schema", "/properties/baz", - "https://www.sourcemeta.com/baz", "", {"/baz"}, ""); + "https://www.sourcemeta.com/baz", "", ""); EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/baz#extra", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/qux", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~I~"}, "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); // foo EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$id", "https://www.sourcemeta.com/schema", "/properties/foo/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$anchor", "https://www.sourcemeta.com/schema", "/properties/foo/$anchor", - "https://www.sourcemeta.com/foo", "/$anchor", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo/items", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~I~"}, "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/items/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/schema", "/properties/foo/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/$anchor", "https://www.sourcemeta.com/schema", "/properties/foo/$anchor", - "https://www.sourcemeta.com/foo", "/$anchor", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/foo#/items", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~I~"}, "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/foo#/items/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/qux#/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); // bar EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/bar#/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); // baz EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz", "https://www.sourcemeta.com/schema", "/properties/baz", - "https://www.sourcemeta.com/baz", "", {"/baz"}, ""); + "https://www.sourcemeta.com/baz", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/baz/$id", "https://www.sourcemeta.com/schema", "/properties/baz/$id", - "https://www.sourcemeta.com/baz", "/$id", {}, "/properties/baz"); + "https://www.sourcemeta.com/baz", "/$id", "/properties/baz"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/baz/items/$anchor", "https://www.sourcemeta.com/schema", "/properties/baz/items/$anchor", - "https://www.sourcemeta.com/baz", "/items/$anchor", {}, + "https://www.sourcemeta.com/baz", "/items/$anchor", "/properties/baz/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/baz#/$id", "https://www.sourcemeta.com/schema", "/properties/baz/$id", - "https://www.sourcemeta.com/baz", "/$id", {}, "/properties/baz"); + "https://www.sourcemeta.com/baz", "/$id", "/properties/baz"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/baz#/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/baz#/items/$anchor", "https://www.sourcemeta.com/schema", "/properties/baz/items/$anchor", - "https://www.sourcemeta.com/baz", "/items/$anchor", {}, + "https://www.sourcemeta.com/baz", "/items/$anchor", "/properties/baz/items"); // References @@ -590,7 +582,7 @@ TEST(JSONSchema_frame_2019_09, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -605,7 +597,7 @@ TEST(JSONSchema_frame_2019_09, static_anchor_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -618,7 +610,7 @@ TEST(JSONSchema_frame_2019_09, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2019-09/schema", @@ -628,18 +620,18 @@ TEST(JSONSchema_frame_2019_09, explicit_argument_id_same) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -659,7 +651,7 @@ TEST(JSONSchema_frame_2019_09, anchor_top_level) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -668,26 +660,26 @@ TEST(JSONSchema_frame_2019_09, anchor_top_level) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$anchor", "https://www.sourcemeta.com/schema", "/$anchor", - "https://www.sourcemeta.com/schema", "/$anchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$anchor", ""); // Anchors EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // References @@ -719,7 +711,7 @@ TEST(JSONSchema_frame_2019_09, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2019-09/schema", @@ -730,105 +722,104 @@ TEST(JSONSchema_frame_2019_09, explicit_argument_id_different) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_2019_09_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_2019_09_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // Anchors EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.example.com#foo", "https://www.sourcemeta.com/schema", - "/items", "https://www.example.com", "/items", {"/~I~"}, ""); + "/items", "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/test#bar", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); - EXPECT_FRAME_STATIC_2019_09_ANCHOR( - frame, "https://www.example.com/test#bar", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); + EXPECT_FRAME_STATIC_2019_09_ANCHOR(frame, "https://www.example.com/test#bar", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_2019_09_ANCHOR( frame, "https://www.test.com#baz", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$anchor", "https://www.sourcemeta.com/schema", "/items/$anchor", - "https://www.sourcemeta.com/schema", "/items/$anchor", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/$anchor", "/items"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$anchor", "https://www.sourcemeta.com/schema", "/properties/one/$anchor", - "https://www.sourcemeta.com/test", "/$anchor", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$anchor", "/properties/one"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$id", "https://www.sourcemeta.com/schema", "/properties/two/$id", - "https://www.test.com", "/$id", {}, "/properties/two"); + "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$anchor", "https://www.sourcemeta.com/schema", "/properties/two/$anchor", - "https://www.test.com", "/$anchor", {}, "/properties/two"); + "https://www.test.com", "/$anchor", "/properties/two"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test#/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/test#/$anchor", "https://www.sourcemeta.com/schema", "/properties/one/$anchor", - "https://www.sourcemeta.com/test", "/$anchor", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$anchor", "/properties/one"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.test.com#/$id", "https://www.sourcemeta.com/schema", - "/properties/two/$id", "https://www.test.com", "/$id", {}, - "/properties/two"); + "/properties/two/$id", "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.test.com#/$anchor", "https://www.sourcemeta.com/schema", "/properties/two/$anchor", - "https://www.test.com", "/$anchor", {}, "/properties/two"); + "https://www.test.com", "/$anchor", "/properties/two"); // References @@ -847,7 +838,7 @@ TEST(JSONSchema_frame_2019_09, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -855,14 +846,14 @@ TEST(JSONSchema_frame_2019_09, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // References @@ -892,7 +883,7 @@ TEST(JSONSchema_frame_2019_09, location_independent_identifier_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), @@ -907,7 +898,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_true_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -918,29 +909,29 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_true_with_id) { EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // Static identifiers EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // Static pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/$recursiveAnchor", - "https://www.sourcemeta.com/schema", "/$recursiveAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$recursiveAnchor", ""); // References @@ -960,7 +951,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_false_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -971,22 +962,22 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_false_with_id) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // Static pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/$recursiveAnchor", - "https://www.sourcemeta.com/schema", "/$recursiveAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$recursiveAnchor", ""); // References @@ -1009,7 +1000,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_true_without_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1020,30 +1011,30 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_true_without_id) { EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "", "/properties/foo", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // Static frames EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$recursiveAnchor", "/properties/foo/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2019-09/schema", "/properties/foo"); // References @@ -1066,7 +1057,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_false_without_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1076,24 +1067,24 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_false_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$recursiveAnchor", "/properties/foo/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2019-09/schema", "/properties/foo"); // References @@ -1114,7 +1105,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_no_recursive_anchor_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1122,22 +1113,20 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_no_recursive_anchor_anonymous) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // References @@ -1161,7 +1150,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_no_recursive_anchor) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1170,26 +1159,24 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_no_recursive_anchor) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/additionalItems", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/schema", "/additionalItems", - {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/additionalItems", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", {}, + "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", "/additionalItems"); // References @@ -1216,7 +1203,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_false_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1224,26 +1211,24 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_false_anonymous) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$recursiveAnchor", "/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // References @@ -1268,7 +1253,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_false) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1277,30 +1262,28 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_false) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/$recursiveAnchor", - "https://www.sourcemeta.com/schema", "/$recursiveAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$recursiveAnchor", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/additionalItems", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/schema", "/additionalItems", - {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/additionalItems", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", {}, + "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", "/additionalItems"); // References @@ -1327,7 +1310,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_true_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1335,33 +1318,30 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_true_anonymous) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$recursiveAnchor", "/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // Anchors EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); // References @@ -1386,7 +1366,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_true) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1395,30 +1375,28 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_true) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/$recursiveAnchor", - "https://www.sourcemeta.com/schema", "/$recursiveAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$recursiveAnchor", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/additionalItems", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/schema", "/additionalItems", - {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/additionalItems", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", {}, + "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", "/additionalItems"); // Anchors @@ -1426,8 +1404,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_recursive_anchor_true) { EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // References @@ -1455,7 +1432,7 @@ TEST(JSONSchema_frame_2019_09, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1464,50 +1441,48 @@ TEST(JSONSchema_frame_2019_09, EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$id", "/additionalItems/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalItems/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // References @@ -1534,7 +1509,7 @@ TEST(JSONSchema_frame_2019_09, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1543,58 +1518,55 @@ TEST(JSONSchema_frame_2019_09, EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$id", "/additionalItems/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalItems/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$recursiveRef", "/additionalItems/$recursiveRef", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // Anchors EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "https://example.com", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // References @@ -1620,7 +1592,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_nested_recursive_anchor_true) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1629,31 +1601,30 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_nested_recursive_anchor_true) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveAnchor", - {}, "/additionalItems"); + "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/additionalItems", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/schema", "/additionalItems", - {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/additionalItems", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", {}, + "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", "/additionalItems"); // Anchors @@ -1661,8 +1632,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_nested_recursive_anchor_true) { EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/schema", "/additionalItems", - {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/additionalItems", ""); // References @@ -1691,7 +1661,7 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1700,58 +1670,57 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/nested", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/nested", "", {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/nested", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/$recursiveAnchor", - "https://www.sourcemeta.com/schema", "/$recursiveAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$recursiveAnchor", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/additionalItems", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/nested", "", {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/nested", "", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$id", "https://www.sourcemeta.com/schema", "/additionalItems/$id", - "https://www.sourcemeta.com/nested", "/$id", {}, "/additionalItems"); + "https://www.sourcemeta.com/nested", "/$id", "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveAnchor", - "https://www.sourcemeta.com/nested", "/$recursiveAnchor", {}, + "https://www.sourcemeta.com/nested", "/$recursiveAnchor", "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/additionalItems/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/nested", "/$recursiveRef", {}, + "https://www.sourcemeta.com/nested", "/$recursiveRef", "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/nested#/$id", "https://www.sourcemeta.com/schema", "/additionalItems/$id", - "https://www.sourcemeta.com/nested", "/$id", {}, "/additionalItems"); + "https://www.sourcemeta.com/nested", "/$id", "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/nested#/$recursiveAnchor", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveAnchor", - "https://www.sourcemeta.com/nested", "/$recursiveAnchor", {}, + "https://www.sourcemeta.com/nested", "/$recursiveAnchor", "/additionalItems"); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/nested#/$recursiveRef", "https://www.sourcemeta.com/schema", "/additionalItems/$recursiveRef", - "https://www.sourcemeta.com/nested", "/$recursiveRef", {}, + "https://www.sourcemeta.com/nested", "/$recursiveRef", "/additionalItems"); // Anchors @@ -1759,12 +1728,11 @@ TEST(JSONSchema_frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", - POINTER_TEMPLATES("", "/~?additionalItems~/~I~"), std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_DYNAMIC_2019_09_ANCHOR( frame, "https://www.sourcemeta.com/nested", "https://www.sourcemeta.com/schema", "/additionalItems", - "https://www.sourcemeta.com/nested", "", {"/~?additionalItems~/~I~"}, ""); + "https://www.sourcemeta.com/nested", "", ""); // References @@ -1791,7 +1759,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_conflict) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -1805,7 +1773,7 @@ TEST(JSONSchema_frame_2019_09, invalid_recursive_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; try { frame.analyse(document, sourcemeta::core::schema_walker, @@ -1830,7 +1798,7 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_on_relative_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1838,56 +1806,53 @@ TEST(JSONSchema_frame_2019_09, recursive_anchor_on_relative_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "middle", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$recursiveAnchor", "/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalItems", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$id", "/additionalItems/$id", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalItems/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "middle#/$recursiveAnchor", "/additionalItems/$recursiveAnchor", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/additionalItems"); + "https://json-schema.org/draft/2019-09/schema", "/additionalItems"); // Anchors EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "middle", "/additionalItems", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", - {"/~?additionalItems~/~I~"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); // References @@ -1910,7 +1875,7 @@ TEST(JSONSchema_frame_2019_09, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1919,34 +1884,34 @@ TEST(JSONSchema_frame_2019_09, ref_with_id) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/string", "https://www.sourcemeta.com/schema", "/$defs/string", - "https://www.sourcemeta.com/schema", "/$defs/string", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/string", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/string/type", "https://www.sourcemeta.com/schema", "/$defs/string/type", - "https://www.sourcemeta.com/schema", "/$defs/string/type", {}, + "https://www.sourcemeta.com/schema", "/$defs/string/type", "/$defs/string"); // References @@ -1974,7 +1939,7 @@ TEST(JSONSchema_frame_2019_09, ref_from_definitions) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1983,43 +1948,43 @@ TEST(JSONSchema_frame_2019_09, ref_from_definitions) { EXPECT_FRAME_STATIC_2019_09_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions", "https://www.sourcemeta.com/schema", "/definitions", - "https://www.sourcemeta.com/schema", "/definitions", {}, ""); + "https://www.sourcemeta.com/schema", "/definitions", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/definitions/middle", "https://www.sourcemeta.com/schema", "/definitions/middle", - "https://www.sourcemeta.com/schema", "/definitions/middle", {""}, ""); + "https://www.sourcemeta.com/schema", "/definitions/middle", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions/middle/$ref", "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", - "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", {}, + "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", "/definitions/middle"); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/definitions/string", "https://www.sourcemeta.com/schema", "/definitions/string", - "https://www.sourcemeta.com/schema", "/definitions/string", {""}, ""); + "https://www.sourcemeta.com/schema", "/definitions/string", ""); EXPECT_FRAME_STATIC_2019_09_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions/string/type", "https://www.sourcemeta.com/schema", "/definitions/string/type", - "https://www.sourcemeta.com/schema", "/definitions/string/type", {}, + "https://www.sourcemeta.com/schema", "/definitions/string/type", "/definitions/string"); // References @@ -2048,21 +2013,21 @@ TEST(JSONSchema_frame_2019_09, relative_base_uri_without_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_2019_09_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); // References @@ -2087,42 +2052,40 @@ TEST(JSONSchema_frame_2019_09, relative_base_uri_with_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 10); EXPECT_FRAME_STATIC_2019_09_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // Anchors EXPECT_FRAME_STATIC_2019_09_ANCHOR(frame, "common#foo", "common", - "/$defs/foo", "common", "/$defs/foo", {""}, - ""); + "/$defs/foo", "common", "/$defs/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/allOf", "common", - "/allOf", "common", "/allOf", {}, ""); + "/allOf", "common", "/allOf", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA(frame, "common#/allOf/0", "common", - "/allOf/0", "common", "/allOf/0", {""}, - ""); + "/allOf/0", "common", "/allOf/0", ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/allOf/0/$ref", "common", "/allOf/0/$ref", "common", - "/allOf/0/$ref", {}, "/allOf/0"); + "/allOf/0/$ref", "/allOf/0"); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$defs", "common", - "/$defs", "common", "/$defs", {}, ""); + "/$defs", "common", "/$defs", ""); EXPECT_FRAME_STATIC_2019_09_SUBSCHEMA(frame, "common#/$defs/foo", "common", "/$defs/foo", "common", "/$defs/foo", - {""}, ""); + ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "common#/$defs/foo/$anchor", "common", "/$defs/foo/$anchor", "common", - "/$defs/foo/$anchor", {}, "/$defs/foo"); + "/$defs/foo/$anchor", "/$defs/foo"); // References @@ -2143,20 +2106,20 @@ TEST(JSONSchema_frame_2019_09, relative_id_leading_slash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_2019_09_RESOURCE(frame, "/base", "/base", "", "/base", "", - {""}, std::nullopt); + std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "/base#/$id", "/base", "/$id", - "/base", "/$id", {}, ""); + "/base", "/$id", ""); EXPECT_FRAME_STATIC_2019_09_POINTER(frame, "/base#/$schema", "/base", - "/$schema", "/base", "/$schema", {}, ""); + "/$schema", "/base", "/$schema", ""); // References @@ -2188,7 +2151,7 @@ TEST(JSONSchema_frame_2019_09, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -2196,51 +2159,49 @@ TEST(JSONSchema_frame_2019_09, EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2019-09/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2019-09/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2019-09/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties", "/properties/foo/properties", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2019-09/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo/properties/bar", "/properties/foo/properties/bar", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {"/foo/bar"}, - "/properties/foo"); + "https://json-schema.org/draft/2019-09/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/$ref", "/properties/foo/properties/bar/$ref", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, + "https://json-schema.org/draft/2019-09/schema", "/properties/foo/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo/properties/bar/additionalProperties", "/properties/foo/properties/bar/additionalProperties", "https://json-schema.org/draft/2019-09/schema", "https://json-schema.org/draft/2019-09/schema", - {"/foo/bar/~?additionalProperties~/~P~"}, "/properties/foo/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties/$ref", "/properties/foo/properties/bar/additionalProperties/$ref", "https://json-schema.org/draft/2019-09/schema", - "https://json-schema.org/draft/2019-09/schema", {}, + "https://json-schema.org/draft/2019-09/schema", "/properties/foo/properties/bar/additionalProperties"); EXPECT_EQ(frame.references().size(), 4); diff --git a/test/jsonschema/jsonschema_frame_2020_12_test.cc b/test/jsonschema/jsonschema_frame_2020_12_test.cc index 63c444413..0d59d7370 100644 --- a/test/jsonschema/jsonschema_frame_2020_12_test.cc +++ b/test/jsonschema/jsonschema_frame_2020_12_test.cc @@ -8,49 +8,48 @@ #define EXPECT_FRAME_STATIC_2020_12_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2020-12/schema", \ "https://json-schema.org/draft/2020-12/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2020_12_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2020-12/schema", \ "https://json-schema.org/draft/2020-12/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2020_12_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2020-12/schema", \ "https://json-schema.org/draft/2020-12/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2020-12/schema", \ "https://json-schema.org/draft/2020-12/schema", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); #define EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_DYNAMIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "https://json-schema.org/draft/2020-12/schema", \ "https://json-schema.org/draft/2020-12/schema", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_2020_12, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -59,7 +58,7 @@ TEST(JSONSchema_frame_2020_12, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -68,33 +67,29 @@ TEST(JSONSchema_frame_2020_12, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - {"/~?additionalProperties~/~P~"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalProperties/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, - "/additionalProperties"); + "https://json-schema.org/draft/2020-12/schema", "/additionalProperties"); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - {"/~?additionalProperties~/~P~"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/$id", "/additionalProperties/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, - "/additionalProperties"); + "https://json-schema.org/draft/2020-12/schema", "/additionalProperties"); // References @@ -113,7 +108,7 @@ TEST(JSONSchema_frame_2020_12, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -121,18 +116,18 @@ TEST(JSONSchema_frame_2020_12, empty_schema) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -151,7 +146,7 @@ TEST(JSONSchema_frame_2020_12, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -159,18 +154,18 @@ TEST(JSONSchema_frame_2020_12, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -193,7 +188,7 @@ TEST(JSONSchema_frame_2020_12, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -201,38 +196,38 @@ TEST(JSONSchema_frame_2020_12, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -256,7 +251,7 @@ TEST(JSONSchema_frame_2020_12, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -264,68 +259,68 @@ TEST(JSONSchema_frame_2020_12, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); // Anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/test/qux#test", "https://www.sourcemeta.com/test/qux", "/properties/foo", - "https://www.sourcemeta.com/test/qux", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/test/qux", "/properties/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$id", "https://www.sourcemeta.com/test/qux", "/$id", - "https://www.sourcemeta.com/test/qux", "/$id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties", "https://www.sourcemeta.com/test/qux", "/properties", - "https://www.sourcemeta.com/test/qux", "/properties", {}, ""); + "https://www.sourcemeta.com/test/qux", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/properties/foo", "https://www.sourcemeta.com/test/qux", "/properties/foo", - "https://www.sourcemeta.com/test/qux", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/test/qux", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties/foo/$anchor", "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", - "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", {}, + "https://www.sourcemeta.com/test/qux", "/properties/foo/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test/qux#/properties/foo/type", "https://www.sourcemeta.com/test/qux", "/properties/foo/type", - "https://www.sourcemeta.com/test/qux", "/properties/foo/type", {}, + "https://www.sourcemeta.com/test/qux", "/properties/foo/type", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -348,7 +343,7 @@ TEST(JSONSchema_frame_2020_12, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -356,34 +351,34 @@ TEST(JSONSchema_frame_2020_12, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -420,7 +415,7 @@ TEST(JSONSchema_frame_2020_12, nested_schemas) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -429,141 +424,135 @@ TEST(JSONSchema_frame_2020_12, nested_schemas) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/foo#test", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/baz", "https://www.sourcemeta.com/schema", "/properties/baz", - "https://www.sourcemeta.com/baz", "", {"/baz"}, ""); + "https://www.sourcemeta.com/baz", "", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/baz#extra", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~?items~/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/qux", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~?items~/~I~"}, - "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); // foo EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/foo", "", {"/foo"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$id", "https://www.sourcemeta.com/schema", "/properties/foo/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$anchor", "https://www.sourcemeta.com/schema", "/properties/foo/$anchor", - "https://www.sourcemeta.com/foo", "/$anchor", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo/items", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~?items~/~I~"}, - "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/items/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/schema", "/properties/foo/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/foo#/$anchor", "https://www.sourcemeta.com/schema", "/properties/foo/$anchor", - "https://www.sourcemeta.com/foo", "/$anchor", {}, "/properties/foo"); + "https://www.sourcemeta.com/foo", "/$anchor", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/foo#/items", "https://www.sourcemeta.com/schema", "/properties/foo/items", - "https://www.sourcemeta.com/qux", "", {"/foo/~?items~/~I~"}, - "/properties/foo"); + "https://www.sourcemeta.com/qux", "", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/foo#/items/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/qux#/$id", "https://www.sourcemeta.com/schema", "/properties/foo/items/$id", - "https://www.sourcemeta.com/qux", "/$id", {}, "/properties/foo/items"); + "https://www.sourcemeta.com/qux", "/$id", "/properties/foo/items"); // bar EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/bar#/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); // baz EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz", "https://www.sourcemeta.com/schema", "/properties/baz", - "https://www.sourcemeta.com/baz", "", {"/baz"}, ""); + "https://www.sourcemeta.com/baz", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/baz/$id", "https://www.sourcemeta.com/schema", "/properties/baz/$id", - "https://www.sourcemeta.com/baz", "/$id", {}, "/properties/baz"); + "https://www.sourcemeta.com/baz", "/$id", "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~?items~/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/baz/items/$anchor", "https://www.sourcemeta.com/schema", "/properties/baz/items/$anchor", - "https://www.sourcemeta.com/baz", "/items/$anchor", {}, + "https://www.sourcemeta.com/baz", "/items/$anchor", "/properties/baz/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/baz#/$id", "https://www.sourcemeta.com/schema", "/properties/baz/$id", - "https://www.sourcemeta.com/baz", "/$id", {}, "/properties/baz"); + "https://www.sourcemeta.com/baz", "/$id", "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/baz#/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", - "https://www.sourcemeta.com/baz", "/items", {"/baz/~?items~/~I~"}, - "/properties/baz"); + "https://www.sourcemeta.com/baz", "/items", "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/baz#/items/$anchor", "https://www.sourcemeta.com/schema", "/properties/baz/items/$anchor", - "https://www.sourcemeta.com/baz", "/items/$anchor", {}, + "https://www.sourcemeta.com/baz", "/items/$anchor", "/properties/baz/items"); // References @@ -584,7 +573,7 @@ TEST(JSONSchema_frame_2020_12, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -599,7 +588,7 @@ TEST(JSONSchema_frame_2020_12, static_anchor_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -612,7 +601,7 @@ TEST(JSONSchema_frame_2020_12, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", @@ -622,18 +611,18 @@ TEST(JSONSchema_frame_2020_12, explicit_argument_id_same) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -653,7 +642,7 @@ TEST(JSONSchema_frame_2020_12, anchor_top_level) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -662,26 +651,26 @@ TEST(JSONSchema_frame_2020_12, anchor_top_level) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$anchor", "https://www.sourcemeta.com/schema", "/$anchor", - "https://www.sourcemeta.com/schema", "/$anchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$anchor", ""); // Anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // References @@ -713,7 +702,7 @@ TEST(JSONSchema_frame_2020_12, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", @@ -724,106 +713,105 @@ TEST(JSONSchema_frame_2020_12, explicit_argument_id_different) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_2020_12_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // Anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.example.com#foo", "https://www.sourcemeta.com/schema", - "/items", "https://www.example.com", "/items", {"/~?items~/~I~"}, ""); + "/items", "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/test#bar", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); - EXPECT_FRAME_STATIC_2020_12_ANCHOR( - frame, "https://www.example.com/test#bar", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); + EXPECT_FRAME_STATIC_2020_12_ANCHOR(frame, "https://www.example.com/test#bar", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.test.com#baz", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$anchor", "https://www.sourcemeta.com/schema", "/items/$anchor", - "https://www.sourcemeta.com/schema", "/items/$anchor", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/$anchor", "/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$anchor", "https://www.sourcemeta.com/schema", "/properties/one/$anchor", - "https://www.sourcemeta.com/test", "/$anchor", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$anchor", "/properties/one"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$id", "https://www.sourcemeta.com/schema", "/properties/two/$id", - "https://www.test.com", "/$id", {}, "/properties/two"); + "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$anchor", "https://www.sourcemeta.com/schema", "/properties/two/$anchor", - "https://www.test.com", "/$anchor", {}, "/properties/two"); + "https://www.test.com", "/$anchor", "/properties/two"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test#/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/test#/$anchor", "https://www.sourcemeta.com/schema", "/properties/one/$anchor", - "https://www.sourcemeta.com/test", "/$anchor", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$anchor", "/properties/one"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.test.com#/$id", "https://www.sourcemeta.com/schema", - "/properties/two/$id", "https://www.test.com", "/$id", {}, - "/properties/two"); + "/properties/two/$id", "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.test.com#/$anchor", "https://www.sourcemeta.com/schema", "/properties/two/$anchor", - "https://www.test.com", "/$anchor", {}, "/properties/two"); + "https://www.test.com", "/$anchor", "/properties/two"); // References @@ -866,7 +854,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_refs_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -929,7 +917,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_refs_with_no_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -973,7 +961,7 @@ TEST(JSONSchema_frame_2020_12, ref_to_dynamic_anchor) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1005,7 +993,7 @@ TEST(JSONSchema_frame_2020_12, different_dynamic_and_refs_in_same_object) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1041,7 +1029,7 @@ TEST(JSONSchema_frame_2020_12, same_dynamic_and_refs_in_same_object) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1080,7 +1068,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1091,99 +1079,97 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_with_id) { EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#test", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/bar#test", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); // Static anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#test", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/bar#test", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); // Static identifiers EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); // Static pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$dynamicAnchor", "https://www.sourcemeta.com/schema", "/$dynamicAnchor", - "https://www.sourcemeta.com/schema", "/$dynamicAnchor", {}, ""); + "https://www.sourcemeta.com/schema", "/$dynamicAnchor", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$dynamicAnchor", "https://www.sourcemeta.com/schema", "/properties/foo/$dynamicAnchor", - "https://www.sourcemeta.com/schema", "/properties/foo/$dynamicAnchor", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$dynamicAnchor", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/bar", "", {"/bar"}, ""); + "https://www.sourcemeta.com/bar", "", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$dynamicAnchor", "https://www.sourcemeta.com/schema", "/properties/bar/$dynamicAnchor", - "https://www.sourcemeta.com/bar", "/$dynamicAnchor", {}, - "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$dynamicAnchor", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$anchor", "https://www.sourcemeta.com/schema", "/properties/bar/$anchor", - "https://www.sourcemeta.com/bar", "/$anchor", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$anchor", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/bar#/$id", "https://www.sourcemeta.com/schema", "/properties/bar/$id", - "https://www.sourcemeta.com/bar", "/$id", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$id", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/bar#/$dynamicAnchor", "https://www.sourcemeta.com/schema", "/properties/bar/$dynamicAnchor", - "https://www.sourcemeta.com/bar", "/$dynamicAnchor", {}, - "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$dynamicAnchor", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/bar#/$anchor", "https://www.sourcemeta.com/schema", "/properties/bar/$anchor", - "https://www.sourcemeta.com/bar", "/$anchor", {}, "/properties/bar"); + "https://www.sourcemeta.com/bar", "/$anchor", "/properties/bar"); // References @@ -1206,7 +1192,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_without_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1217,34 +1203,34 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_without_id) { EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "#test", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#test", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Static frames EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$dynamicAnchor", "/properties/foo/$dynamicAnchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); // References @@ -1269,7 +1255,7 @@ TEST(JSONSchema_frame_2020_12, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1280,37 +1266,37 @@ TEST(JSONSchema_frame_2020_12, EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "#test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Static frames EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$dynamicRef", "/$dynamicRef", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/test/$dynamicAnchor", "/$defs/test/$dynamicAnchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/test"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/test"); // References @@ -1339,7 +1325,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_to_single_dynamic_anchor_external) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1350,45 +1336,45 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_to_single_dynamic_anchor_external) { EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( frame, "#test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Static frames EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$dynamicRef", "/$dynamicRef", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/test", "/$defs/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/test/$dynamicAnchor", "/$defs/test/$dynamicAnchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/test"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/test"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/foo", "/$defs/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/foo/$ref", "/$defs/foo/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/foo"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/foo"); // References @@ -1416,7 +1402,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_same_on_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -1433,7 +1419,7 @@ TEST(JSONSchema_frame_2020_12, no_id_recursive_empty_pointer) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1441,24 +1427,23 @@ TEST(JSONSchema_frame_2020_12, no_id_recursive_empty_pointer) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - POINTER_TEMPLATES("", "/foo"), std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); // References @@ -1479,7 +1464,7 @@ TEST(JSONSchema_frame_2020_12, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1487,14 +1472,14 @@ TEST(JSONSchema_frame_2020_12, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // References @@ -1524,7 +1509,7 @@ TEST(JSONSchema_frame_2020_12, location_independent_identifier_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), @@ -1542,7 +1527,7 @@ TEST(JSONSchema_frame_2020_12, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1551,34 +1536,34 @@ TEST(JSONSchema_frame_2020_12, ref_with_id) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/string", "https://www.sourcemeta.com/schema", "/$defs/string", - "https://www.sourcemeta.com/schema", "/$defs/string", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/string", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/string/type", "https://www.sourcemeta.com/schema", "/$defs/string/type", - "https://www.sourcemeta.com/schema", "/$defs/string/type", {}, + "https://www.sourcemeta.com/schema", "/$defs/string/type", "/$defs/string"); // References @@ -1606,7 +1591,7 @@ TEST(JSONSchema_frame_2020_12, ref_from_definitions) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1615,43 +1600,43 @@ TEST(JSONSchema_frame_2020_12, ref_from_definitions) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions", "https://www.sourcemeta.com/schema", "/definitions", - "https://www.sourcemeta.com/schema", "/definitions", {}, ""); + "https://www.sourcemeta.com/schema", "/definitions", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/definitions/middle", "https://www.sourcemeta.com/schema", "/definitions/middle", - "https://www.sourcemeta.com/schema", "/definitions/middle", {""}, ""); + "https://www.sourcemeta.com/schema", "/definitions/middle", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions/middle/$ref", "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", - "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", {}, + "https://www.sourcemeta.com/schema", "/definitions/middle/$ref", "/definitions/middle"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/definitions/string", "https://www.sourcemeta.com/schema", "/definitions/string", - "https://www.sourcemeta.com/schema", "/definitions/string", {""}, ""); + "https://www.sourcemeta.com/schema", "/definitions/string", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/definitions/string/type", "https://www.sourcemeta.com/schema", "/definitions/string/type", - "https://www.sourcemeta.com/schema", "/definitions/string/type", {}, + "https://www.sourcemeta.com/schema", "/definitions/string/type", "/definitions/string"); // References @@ -1680,21 +1665,21 @@ TEST(JSONSchema_frame_2020_12, relative_base_uri_without_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); // References @@ -1719,42 +1704,40 @@ TEST(JSONSchema_frame_2020_12, relative_base_uri_with_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 10); EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // Anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR(frame, "common#foo", "common", - "/$defs/foo", "common", "/$defs/foo", {""}, - ""); + "/$defs/foo", "common", "/$defs/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/allOf", "common", - "/allOf", "common", "/allOf", {}, ""); + "/allOf", "common", "/allOf", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA(frame, "common#/allOf/0", "common", - "/allOf/0", "common", "/allOf/0", {""}, - ""); + "/allOf/0", "common", "/allOf/0", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/allOf/0/$ref", "common", "/allOf/0/$ref", "common", - "/allOf/0/$ref", {}, "/allOf/0"); + "/allOf/0/$ref", "/allOf/0"); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$defs", "common", - "/$defs", "common", "/$defs", {}, ""); + "/$defs", "common", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA(frame, "common#/$defs/foo", "common", "/$defs/foo", "common", "/$defs/foo", - {""}, ""); + ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "common#/$defs/foo/$anchor", "common", "/$defs/foo/$anchor", "common", - "/$defs/foo/$anchor", {}, "/$defs/foo"); + "/$defs/foo/$anchor", "/$defs/foo"); // References @@ -1776,24 +1759,24 @@ TEST(JSONSchema_frame_2020_12, relative_base_with_relative_path_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 4); EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "foo/bar/baz", "foo/bar/baz", "", - "foo/bar/baz", "", {""}, std::nullopt); + "foo/bar/baz", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "foo/bar/baz#/$schema", "foo/bar/baz", "/$schema", "foo/bar/baz", - "/$schema", {}, ""); + "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "foo/bar/baz#/$id", "foo/bar/baz", - "/$id", "foo/bar/baz", "/$id", {}, ""); + "/$id", "foo/bar/baz", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "foo/bar/baz#/$ref", "foo/bar/baz", - "/$ref", "foo/bar/baz", "/$ref", {}, ""); + "/$ref", "foo/bar/baz", "/$ref", ""); // References @@ -1818,7 +1801,7 @@ TEST(JSONSchema_frame_2020_12, idempotent_with_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1832,30 +1815,30 @@ TEST(JSONSchema_frame_2020_12, idempotent_with_refs) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/string", "https://www.sourcemeta.com/schema", "/$defs/string", - "https://www.sourcemeta.com/schema", "/$defs/string", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/string", ""); // References @@ -1880,7 +1863,7 @@ TEST(JSONSchema_frame_2020_12, allof_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1921,7 +1904,7 @@ TEST(JSONSchema_frame_2020_12, properties_with_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1930,58 +1913,56 @@ TEST(JSONSchema_frame_2020_12, properties_with_refs) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", - POINTER_TEMPLATES("/foo", "/bar", "/baz/~?items~/~I~"), ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/schema", "/properties/bar", - POINTER_TEMPLATES("/bar", "/baz/~?items~/~I~"), ""); + "https://www.sourcemeta.com/schema", "/properties/bar", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$ref", "https://www.sourcemeta.com/schema", "/properties/bar/$ref", - "https://www.sourcemeta.com/schema", "/properties/bar/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/bar/$ref", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz", "https://www.sourcemeta.com/schema", "/properties/baz", - "https://www.sourcemeta.com/schema", "/properties/baz", {"/baz"}, ""); + "https://www.sourcemeta.com/schema", "/properties/baz", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/baz/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", "https://www.sourcemeta.com/schema", "/properties/baz/items", - {"/baz/~?items~/~I~"}, "/properties/baz"); + "/properties/baz"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/baz/items/$ref", "https://www.sourcemeta.com/schema", "/properties/baz/items/$ref", - "https://www.sourcemeta.com/schema", "/properties/baz/items/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/baz/items/$ref", "/properties/baz/items"); // References @@ -2026,7 +2007,7 @@ TEST(JSONSchema_frame_2020_12, property_ref_defs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -2035,55 +2016,55 @@ TEST(JSONSchema_frame_2020_12, property_ref_defs) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$ref", "https://www.sourcemeta.com/schema", "/properties/foo/$ref", - "https://www.sourcemeta.com/schema", "/properties/foo/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$ref", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/schema", "/properties/bar", {"/bar"}, ""); + "https://www.sourcemeta.com/schema", "/properties/bar", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/$ref", "https://www.sourcemeta.com/schema", "/properties/bar/$ref", - "https://www.sourcemeta.com/schema", "/properties/bar/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/bar/$ref", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/helper", "https://www.sourcemeta.com/schema", "/$defs/helper", - "https://www.sourcemeta.com/schema", "/$defs/helper", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/$defs/helper", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/helper/items", "https://www.sourcemeta.com/schema", "/$defs/helper/items", "https://www.sourcemeta.com/schema", "/$defs/helper/items", - POINTER_TEMPLATES("/bar", "/foo/~?items~/~I~"), "/$defs/helper"); + "/$defs/helper"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/helper/items/" @@ -2091,10 +2072,7 @@ TEST(JSONSchema_frame_2020_12, property_ref_defs) { "https://www.sourcemeta.com/schema", "/$defs/helper/items/additionalProperties", "https://www.sourcemeta.com/schema", - "/$defs/helper/items/additionalProperties", - POINTER_TEMPLATES("/bar/~?additionalProperties~/~P~", - "/foo/~?items~/~I~/~?additionalProperties~/~P~"), - "/$defs/helper/items"); + "/$defs/helper/items/additionalProperties", "/$defs/helper/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/helper/items/" @@ -2102,7 +2080,7 @@ TEST(JSONSchema_frame_2020_12, property_ref_defs) { "https://www.sourcemeta.com/schema", "/$defs/helper/items/additionalProperties/type", "https://www.sourcemeta.com/schema", - "/$defs/helper/items/additionalProperties/type", {}, + "/$defs/helper/items/additionalProperties/type", "/$defs/helper/items/additionalProperties"); // References @@ -2142,7 +2120,7 @@ TEST(JSONSchema_frame_2020_12, property_cross_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -2151,47 +2129,45 @@ TEST(JSONSchema_frame_2020_12, property_cross_ref) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$ref", "https://www.sourcemeta.com/schema", "/properties/foo/$ref", - "https://www.sourcemeta.com/schema", "/properties/foo/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$ref", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/schema", "/properties/bar", - POINTER_TEMPLATES("/bar", "/foo"), ""); + "https://www.sourcemeta.com/schema", "/properties/bar", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar/items", "https://www.sourcemeta.com/schema", "/properties/bar/items", "https://www.sourcemeta.com/schema", "/properties/bar/items", - POINTER_TEMPLATES("/bar/~?items~/~I~", "/foo/~?items~/~I~"), "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/bar/items/$anchor", "https://www.sourcemeta.com/schema", "/properties/bar/items/$anchor", - "https://www.sourcemeta.com/schema", "/properties/bar/items/$anchor", {}, + "https://www.sourcemeta.com/schema", "/properties/bar/items/$anchor", "/properties/bar/items"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, @@ -2200,16 +2176,12 @@ TEST(JSONSchema_frame_2020_12, property_cross_ref) { "https://www.sourcemeta.com/schema", "/properties/bar/items/additionalProperties", "https://www.sourcemeta.com/schema", - "/properties/bar/items/additionalProperties", - POINTER_TEMPLATES("/bar/~?items~/~I~/~?additionalProperties~/~P~", - "/foo/~?items~/~I~/~?additionalProperties~/~P~"), - "/properties/bar/items"); + "/properties/bar/items/additionalProperties", "/properties/bar/items"); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#foo", "https://www.sourcemeta.com/schema", "/properties/bar/items", "https://www.sourcemeta.com/schema", "/properties/bar/items", - POINTER_TEMPLATES("/bar/~?items~/~I~", "/foo/~?items~/~I~"), "/properties/bar"); // References @@ -2243,7 +2215,7 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_multiple_targets) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -2251,61 +2223,59 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_multiple_targets) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.example.com", "https://www.example.com", "", - "https://www.example.com", "", POINTER_TEMPLATES("", "/bar"), - std::nullopt); + "https://www.example.com", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.example.com/foo", "https://www.example.com", - "/properties/foo", "https://www.example.com/foo", "", - POINTER_TEMPLATES("/foo", "/bar"), ""); + "/properties/foo", "https://www.example.com/foo", "", ""); // Subschemas EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.example.com#/properties/foo", "https://www.example.com", "/properties/foo", - "https://www.example.com/foo", "", POINTER_TEMPLATES("/foo", "/bar"), ""); + "https://www.example.com/foo", "", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.example.com#/properties/bar", "https://www.example.com", "/properties/bar", "https://www.example.com", - "/properties/bar", {"/bar"}, ""); + "/properties/bar", ""); // JSON Pointers - EXPECT_FRAME_STATIC_2020_12_POINTER( - frame, "https://www.example.com#/$id", "https://www.example.com", "/$id", - "https://www.example.com", "/$id", {}, ""); + EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "https://www.example.com#/$id", + "https://www.example.com", "/$id", + "https://www.example.com", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/$schema", "https://www.example.com", - "/$schema", "https://www.example.com", "/$schema", {}, ""); + "/$schema", "https://www.example.com", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/$dynamicAnchor", "https://www.example.com", "/$dynamicAnchor", "https://www.example.com", - "/$dynamicAnchor", {}, ""); + "/$dynamicAnchor", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/properties", "https://www.example.com", - "/properties", "https://www.example.com", "/properties", {}, ""); + "/properties", "https://www.example.com", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/properties/foo/$id", "https://www.example.com", "/properties/foo/$id", - "https://www.example.com/foo", "/$id", {}, "/properties/foo"); + "https://www.example.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/properties/foo/$dynamicAnchor", "https://www.example.com", "/properties/foo/$dynamicAnchor", - "https://www.example.com/foo", "/$dynamicAnchor", {}, "/properties/foo"); + "https://www.example.com/foo", "/$dynamicAnchor", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com#/properties/bar/$dynamicRef", "https://www.example.com", "/properties/bar/$dynamicRef", - "https://www.example.com", "/properties/bar/$dynamicRef", {}, + "https://www.example.com", "/properties/bar/$dynamicRef", "/properties/bar"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com/foo#/$id", "https://www.example.com", - "/properties/foo/$id", "https://www.example.com/foo", "/$id", {}, + "/properties/foo/$id", "https://www.example.com/foo", "/$id", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.example.com/foo#/$dynamicAnchor", "https://www.example.com", "/properties/foo/$dynamicAnchor", - "https://www.example.com/foo", "/$dynamicAnchor", {}, "/properties/foo"); + "https://www.example.com/foo", "/$dynamicAnchor", "/properties/foo"); // Anchors @@ -2315,21 +2285,17 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_multiple_targets) { // from static anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.example.com#test", "https://www.example.com", "", - "https://www.example.com", "", POINTER_TEMPLATES("", "/bar"), - std::nullopt); + "https://www.example.com", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.example.com/foo#test", "https://www.example.com", - "/properties/foo", "https://www.example.com/foo", "", - POINTER_TEMPLATES("/foo", "/bar"), ""); + "/properties/foo", "https://www.example.com/foo", "", ""); EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( frame, "https://www.example.com#test", "https://www.example.com", "", - "https://www.example.com", "", POINTER_TEMPLATES("", "/bar"), - std::nullopt); + "https://www.example.com", "", std::nullopt); EXPECT_FRAME_DYNAMIC_2020_12_ANCHOR( frame, "https://www.example.com/foo#test", "https://www.example.com", - "/properties/foo", "https://www.example.com/foo", "", - POINTER_TEMPLATES("/foo", "/bar"), ""); + "/properties/foo", "https://www.example.com/foo", "", ""); // References @@ -2366,59 +2332,59 @@ TEST(JSONSchema_frame_2020_12, cross_id_anonymous_nested) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // From the top EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$id", "/$defs/schema/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema/items", "/$defs/schema/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); // From within EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/$defs/schema/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com#/items", "/$defs/schema/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); // References @@ -2444,7 +2410,7 @@ TEST(JSONSchema_frame_2020_12, relative_id_with_absolute_default_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", @@ -2454,23 +2420,22 @@ TEST(JSONSchema_frame_2020_12, relative_id_with_absolute_default_id) { // With current identifier EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "relative", "relative", "", - "relative", "", {""}, std::nullopt); + "relative", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "relative#/$id", "relative", - "/$id", "relative", "/$id", {}, ""); + "/$id", "relative", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER(frame, "relative#/$schema", "relative", - "/$schema", "relative", "/$schema", {}, - ""); + "/$schema", "relative", "/$schema", ""); // With default identifier EXPECT_FRAME_STATIC_2020_12_RESOURCE(frame, "https://example.com/relative", - "relative", "", "relative", "", {""}, + "relative", "", "relative", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://example.com/relative#/$id", "relative", "/$id", - "relative", "/$id", {}, ""); + "relative", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://example.com/relative#/$schema", "relative", "/$schema", - "relative", "/$schema", {}, ""); + "relative", "/$schema", ""); // References @@ -2489,7 +2454,7 @@ TEST(JSONSchema_frame_2020_12, zero_paths) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, std::nullopt, {}); @@ -2508,7 +2473,7 @@ TEST(JSONSchema_frame_2020_12, single_nested_path_recursive_with_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, std::nullopt, {sourcemeta::core::Pointer{"wrapper"}}); @@ -2519,18 +2484,17 @@ TEST(JSONSchema_frame_2020_12, single_nested_path_recursive_with_identifier) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", std::nullopt, "/wrapper", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", std::nullopt, - "/wrapper/$id", "https://www.sourcemeta.com/schema", "/$id", {}, - "/wrapper"); + "/wrapper/$id", "https://www.sourcemeta.com/schema", "/$id", "/wrapper"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", std::nullopt, - "/wrapper/$schema", "https://www.sourcemeta.com/schema", "/$schema", {}, + "/wrapper/$schema", "https://www.sourcemeta.com/schema", "/$schema", "/wrapper"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", std::nullopt, - "/wrapper/$ref", "https://www.sourcemeta.com/schema", "/$ref", {}, + "/wrapper/$ref", "https://www.sourcemeta.com/schema", "/$ref", "/wrapper"); // From the root @@ -2538,19 +2502,19 @@ TEST(JSONSchema_frame_2020_12, single_nested_path_recursive_with_identifier) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$id", "/wrapper/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$schema", "/wrapper/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$ref", "/wrapper/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); // References @@ -2576,7 +2540,7 @@ TEST(JSONSchema_frame_2020_12, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", std::nullopt, @@ -2587,11 +2551,11 @@ TEST(JSONSchema_frame_2020_12, EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$ref", "/wrapper/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); // References @@ -2614,7 +2578,7 @@ TEST(JSONSchema_frame_2020_12, single_nested_anonymous_with_nested_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", std::nullopt, @@ -2625,49 +2589,46 @@ TEST(JSONSchema_frame_2020_12, single_nested_anonymous_with_nested_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper/items", "/wrapper/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/~?items~/~I~"}, - "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/items/$id", "/wrapper/items/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper/items"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper/items"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/items/$schema", "/wrapper/items/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper/items"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper/items"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/items/$anchor", "/wrapper/items/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper/items"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper/items"); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", std::nullopt, - "/wrapper/items", "https://www.sourcemeta.com/schema", "", - {"/~?items~/~I~"}, "/wrapper"); + "/wrapper/items", "https://www.sourcemeta.com/schema", "", "/wrapper"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", std::nullopt, - "/wrapper/items/$id", "https://www.sourcemeta.com/schema", "/$id", {}, + "/wrapper/items/$id", "https://www.sourcemeta.com/schema", "/$id", "/wrapper/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", std::nullopt, "/wrapper/items/$schema", "https://www.sourcemeta.com/schema", "/$schema", - {}, "/wrapper/items"); + "/wrapper/items"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$anchor", std::nullopt, "/wrapper/items/$anchor", "https://www.sourcemeta.com/schema", "/$anchor", - {}, "/wrapper/items"); + "/wrapper/items"); // Anchors EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#test", std::nullopt, - "/wrapper/items", "https://www.sourcemeta.com/schema", "", - {"/~?items~/~I~"}, "/wrapper"); + "/wrapper/items", "https://www.sourcemeta.com/schema", "", "/wrapper"); // References @@ -2700,7 +2661,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_cross_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", std::nullopt, @@ -2713,65 +2674,64 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_cross_ref) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$ref", "/wrapper/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/common/test", "/common/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/test/$anchor", "/common/test/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/test"); + "https://json-schema.org/draft/2020-12/schema", "/common/test"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/test/$ref", "/common/test/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/test"); + "https://json-schema.org/draft/2020-12/schema", "/common/test"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/common/with-id", "/common/with-id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/with-id/$id", "/common/with-id/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/with-id"); + "https://json-schema.org/draft/2020-12/schema", "/common/with-id"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/with-id/$schema", "/common/with-id/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/with-id"); + "https://json-schema.org/draft/2020-12/schema", "/common/with-id"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/with-id/$anchor", "/common/with-id/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/with-id"); + "https://json-schema.org/draft/2020-12/schema", "/common/with-id"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/with-id/type", "/common/with-id/type", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/with-id"); + "https://json-schema.org/draft/2020-12/schema", "/common/with-id"); EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", std::nullopt, - "/common/with-id", "https://www.sourcemeta.com/schema", "", {""}, - std::nullopt); + "/common/with-id", "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", std::nullopt, - "/common/with-id/$id", "https://www.sourcemeta.com/schema", "/$id", {}, + "/common/with-id/$id", "https://www.sourcemeta.com/schema", "/$id", "/common/with-id"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", std::nullopt, "/common/with-id/$schema", "https://www.sourcemeta.com/schema", - "/$schema", {}, "/common/with-id"); + "/$schema", "/common/with-id"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$anchor", std::nullopt, "/common/with-id/$anchor", "https://www.sourcemeta.com/schema", - "/$anchor", {}, "/common/with-id"); + "/$anchor", "/common/with-id"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/type", std::nullopt, - "/common/with-id/type", "https://www.sourcemeta.com/schema", "/type", {}, + "/common/with-id/type", "https://www.sourcemeta.com/schema", "/type", "/common/with-id"); // Anchors @@ -2779,11 +2739,10 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_cross_ref) { EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#foo", "/common/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_FRAME_STATIC_2020_12_ANCHOR( frame, "https://www.sourcemeta.com/schema#bar", std::nullopt, - "/common/with-id", "https://www.sourcemeta.com/schema", "", {""}, - std::nullopt); + "/common/with-id", "https://www.sourcemeta.com/schema", "", std::nullopt); // References @@ -2818,7 +2777,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_cross_ref_missing_target) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", std::nullopt, @@ -2830,20 +2789,20 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_cross_ref_missing_target) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$ref", "/wrapper/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/common/test", "/common/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/test/$ref", "/common/test/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/test"); + "https://json-schema.org/draft/2020-12/schema", "/common/test"); // References @@ -2873,7 +2832,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_no_base_dialect) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, @@ -2899,7 +2858,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_same_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, @@ -2922,7 +2881,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_same_anonymous_anchors) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, @@ -2951,7 +2910,7 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_with_default_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", @@ -2966,20 +2925,20 @@ TEST(JSONSchema_frame_2020_12, multiple_nested_with_default_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/wrapper", "/wrapper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/wrapper/$ref", "/wrapper/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/wrapper"); + "https://json-schema.org/draft/2020-12/schema", "/wrapper"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/common/test", "/common/test", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/common/test/$ref", "/common/test/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/common/test"); + "https://json-schema.org/draft/2020-12/schema", "/common/test"); // References @@ -2998,22 +2957,22 @@ TEST(JSONSchema_frame_2020_12, anchor_with_invalid_type) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$anchor", "/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_EQ(frame.references().size(), 1); EXPECT_STATIC_REFERENCE( @@ -3029,22 +2988,22 @@ TEST(JSONSchema_frame_2020_12, dynamic_anchor_with_invalid_type) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$dynamicAnchor", "/$dynamicAnchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_EQ(frame.references().size(), 1); EXPECT_STATIC_REFERENCE( @@ -3060,22 +3019,22 @@ TEST(JSONSchema_frame_2020_12, dynamic_ref_with_invalid_type) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$dynamicRef", "/$dynamicRef", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_EQ(frame.references().size(), 1); EXPECT_STATIC_REFERENCE( @@ -3104,7 +3063,7 @@ TEST(JSONSchema_frame_2020_12, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -3112,51 +3071,49 @@ TEST(JSONSchema_frame_2020_12, EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties", "/properties/foo/properties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo/properties/bar", "/properties/foo/properties/bar", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo/bar"}, - "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/$ref", "/properties/foo/properties/bar/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, + "https://json-schema.org/draft/2020-12/schema", "/properties/foo/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo/properties/bar/additionalProperties", "/properties/foo/properties/bar/additionalProperties", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - {"/foo/bar/~?additionalProperties~/~P~"}, "/properties/foo/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties/$ref", "/properties/foo/properties/bar/additionalProperties/$ref", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, + "https://json-schema.org/draft/2020-12/schema", "/properties/foo/properties/bar/additionalProperties"); EXPECT_EQ(frame.references().size(), 4); @@ -3193,7 +3150,7 @@ TEST(JSONSchema_frame_2020_12, ref_to_ref_chain) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -3202,42 +3159,41 @@ TEST(JSONSchema_frame_2020_12, ref_to_ref_chain) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/parent", "https://www.sourcemeta.com/schema", "/$defs/parent", - "https://www.sourcemeta.com/schema", "/$defs/parent", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/parent", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/parent/$ref", "https://www.sourcemeta.com/schema", "/$defs/parent/$ref", - "https://www.sourcemeta.com/schema", "/$defs/parent/$ref", {}, + "https://www.sourcemeta.com/schema", "/$defs/parent/$ref", "/$defs/parent"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/child", "https://www.sourcemeta.com/schema", "/$defs/child", - "https://www.sourcemeta.com/schema", "/$defs/child", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/child", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/child/type", "https://www.sourcemeta.com/schema", "/$defs/child/type", - "https://www.sourcemeta.com/schema", "/$defs/child/type", {}, - "/$defs/child"); + "https://www.sourcemeta.com/schema", "/$defs/child/type", "/$defs/child"); EXPECT_EQ(frame.references().size(), 3); @@ -3269,7 +3225,7 @@ TEST(JSONSchema_frame_2020_12, nested_defs_unreferenced) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -3278,45 +3234,45 @@ TEST(JSONSchema_frame_2020_12, nested_defs_unreferenced) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$defs", "https://www.sourcemeta.com/schema", "/properties/foo/$defs", - "https://www.sourcemeta.com/schema", "/properties/foo/$defs", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$defs", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo/$defs/unused", "https://www.sourcemeta.com/schema", "/properties/foo/$defs/unused", - "https://www.sourcemeta.com/schema", "/properties/foo/$defs/unused", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$defs/unused", "/properties/foo"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$defs/unused/type", "https://www.sourcemeta.com/schema", "/properties/foo/$defs/unused/type", "https://www.sourcemeta.com/schema", "/properties/foo/$defs/unused/type", - {}, "/properties/foo/$defs/unused"); + "/properties/foo/$defs/unused"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); EXPECT_EQ(frame.references().size(), 1); @@ -3339,7 +3295,7 @@ TEST(JSONSchema_frame_2020_12, circular_ref_through_defs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -3348,42 +3304,42 @@ TEST(JSONSchema_frame_2020_12, circular_ref_through_defs) { EXPECT_FRAME_STATIC_2020_12_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/a", "https://www.sourcemeta.com/schema", "/$defs/a", - "https://www.sourcemeta.com/schema", "/$defs/a", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/a", ""); EXPECT_FRAME_STATIC_2020_12_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/$defs/b", "https://www.sourcemeta.com/schema", "/$defs/b", - "https://www.sourcemeta.com/schema", "/$defs/b", {""}, ""); + "https://www.sourcemeta.com/schema", "/$defs/b", ""); // JSON Pointers EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs", "https://www.sourcemeta.com/schema", "/$defs", - "https://www.sourcemeta.com/schema", "/$defs", {}, ""); + "https://www.sourcemeta.com/schema", "/$defs", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$ref", "https://www.sourcemeta.com/schema", "/$ref", - "https://www.sourcemeta.com/schema", "/$ref", {}, ""); + "https://www.sourcemeta.com/schema", "/$ref", ""); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/a/$ref", "https://www.sourcemeta.com/schema", "/$defs/a/$ref", - "https://www.sourcemeta.com/schema", "/$defs/a/$ref", {}, "/$defs/a"); + "https://www.sourcemeta.com/schema", "/$defs/a/$ref", "/$defs/a"); EXPECT_FRAME_STATIC_2020_12_POINTER( frame, "https://www.sourcemeta.com/schema#/$defs/b/$ref", "https://www.sourcemeta.com/schema", "/$defs/b/$ref", - "https://www.sourcemeta.com/schema", "/$defs/b/$ref", {}, "/$defs/b"); + "https://www.sourcemeta.com/schema", "/$defs/b/$ref", "/$defs/b"); // References diff --git a/test/jsonschema/jsonschema_frame_draft0_test.cc b/test/jsonschema/jsonschema_frame_draft0_test.cc index 35e76674b..7d16cba11 100644 --- a/test/jsonschema/jsonschema_frame_draft0_test.cc +++ b/test/jsonschema/jsonschema_frame_draft0_test.cc @@ -8,32 +8,30 @@ #define EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-00/schema#", \ "http://json-schema.org/draft-00/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); #define EXPECT_FRAME_STATIC_DRAFT0_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-00/schema#", \ "http://json-schema.org/draft-00/hyper-schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-00/schema#", \ "http://json-schema.org/draft-00/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); TEST(JSONSchema_frame_draft0, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -42,7 +40,7 @@ TEST(JSONSchema_frame_draft0, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -51,32 +49,28 @@ TEST(JSONSchema_frame_draft0, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-00/hyper-schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/id", "/additionalProperties/id", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-00/hyper-schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-00/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {}, ""); + "http://json-schema.org/draft-00/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-00/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/id", "/additionalProperties/id", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-00/hyper-schema#", "/additionalProperties"); // References @@ -95,7 +89,7 @@ TEST(JSONSchema_frame_draft0, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -103,18 +97,18 @@ TEST(JSONSchema_frame_draft0, empty_schema) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -133,7 +127,7 @@ TEST(JSONSchema_frame_draft0, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -141,18 +135,18 @@ TEST(JSONSchema_frame_draft0, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -175,7 +169,7 @@ TEST(JSONSchema_frame_draft0, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -183,38 +177,38 @@ TEST(JSONSchema_frame_draft0, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -235,7 +229,7 @@ TEST(JSONSchema_frame_draft0, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -243,42 +237,42 @@ TEST(JSONSchema_frame_draft0, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT0_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/test/qux#/id", "https://www.sourcemeta.com/test/qux", "/id", - "https://www.sourcemeta.com/test/qux", "/id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -301,7 +295,7 @@ TEST(JSONSchema_frame_draft0, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -309,42 +303,42 @@ TEST(JSONSchema_frame_draft0, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT0_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/items/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -364,7 +358,7 @@ TEST(JSONSchema_frame_draft0, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -377,7 +371,7 @@ TEST(JSONSchema_frame_draft0, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-00/schema#", @@ -387,18 +381,18 @@ TEST(JSONSchema_frame_draft0, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -425,7 +419,7 @@ TEST(JSONSchema_frame_draft0, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-00/schema#", @@ -436,60 +430,59 @@ TEST(JSONSchema_frame_draft0, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT0_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT0_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/id", "https://www.sourcemeta.com/schema", "/properties/two/id", - "https://www.test.com", "/id", {}, "/properties/two"); + "https://www.test.com", "/id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.sourcemeta.com/test#/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT0_POINTER( frame, "https://www.test.com#/id", "https://www.sourcemeta.com/schema", - "/properties/two/id", "https://www.test.com", "/id", {}, - "/properties/two"); + "/properties/two/id", "https://www.test.com", "/id", "/properties/two"); // References @@ -508,7 +501,7 @@ TEST(JSONSchema_frame_draft0, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -516,13 +509,13 @@ TEST(JSONSchema_frame_draft0, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-00/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {}, ""); + "http://json-schema.org/draft-00/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-00/schema#", - "http://json-schema.org/draft-00/hyper-schema#", {}, ""); + "http://json-schema.org/draft-00/hyper-schema#", ""); // References diff --git a/test/jsonschema/jsonschema_frame_draft1_test.cc b/test/jsonschema/jsonschema_frame_draft1_test.cc index b05df45d4..f56db0495 100644 --- a/test/jsonschema/jsonschema_frame_draft1_test.cc +++ b/test/jsonschema/jsonschema_frame_draft1_test.cc @@ -8,32 +8,30 @@ #define EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-01/schema#", \ "http://json-schema.org/draft-01/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); #define EXPECT_FRAME_STATIC_DRAFT1_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-01/schema#", \ "http://json-schema.org/draft-01/hyper-schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-01/schema#", \ "http://json-schema.org/draft-01/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); TEST(JSONSchema_frame_draft1, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -42,7 +40,7 @@ TEST(JSONSchema_frame_draft1, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -51,32 +49,28 @@ TEST(JSONSchema_frame_draft1, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-01/hyper-schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/id", "/additionalProperties/id", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-01/hyper-schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-01/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {}, ""); + "http://json-schema.org/draft-01/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-01/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/id", "/additionalProperties/id", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-01/hyper-schema#", "/additionalProperties"); // References @@ -95,7 +89,7 @@ TEST(JSONSchema_frame_draft1, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -103,18 +97,18 @@ TEST(JSONSchema_frame_draft1, empty_schema) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -133,7 +127,7 @@ TEST(JSONSchema_frame_draft1, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -141,18 +135,18 @@ TEST(JSONSchema_frame_draft1, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -175,7 +169,7 @@ TEST(JSONSchema_frame_draft1, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -183,38 +177,38 @@ TEST(JSONSchema_frame_draft1, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -235,7 +229,7 @@ TEST(JSONSchema_frame_draft1, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -243,42 +237,42 @@ TEST(JSONSchema_frame_draft1, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT1_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/test/qux#/id", "https://www.sourcemeta.com/test/qux", "/id", - "https://www.sourcemeta.com/test/qux", "/id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -301,7 +295,7 @@ TEST(JSONSchema_frame_draft1, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -309,42 +303,42 @@ TEST(JSONSchema_frame_draft1, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT1_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/items/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -364,7 +358,7 @@ TEST(JSONSchema_frame_draft1, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -377,7 +371,7 @@ TEST(JSONSchema_frame_draft1, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-01/schema#", @@ -387,18 +381,18 @@ TEST(JSONSchema_frame_draft1, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -425,7 +419,7 @@ TEST(JSONSchema_frame_draft1, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-01/schema#", @@ -436,60 +430,59 @@ TEST(JSONSchema_frame_draft1, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT1_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT1_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/id", "https://www.sourcemeta.com/schema", "/properties/two/id", - "https://www.test.com", "/id", {}, "/properties/two"); + "https://www.test.com", "/id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.sourcemeta.com/test#/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT1_POINTER( frame, "https://www.test.com#/id", "https://www.sourcemeta.com/schema", - "/properties/two/id", "https://www.test.com", "/id", {}, - "/properties/two"); + "/properties/two/id", "https://www.test.com", "/id", "/properties/two"); // References @@ -508,7 +501,7 @@ TEST(JSONSchema_frame_draft1, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -516,13 +509,13 @@ TEST(JSONSchema_frame_draft1, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-01/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {}, ""); + "http://json-schema.org/draft-01/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-01/schema#", - "http://json-schema.org/draft-01/hyper-schema#", {}, ""); + "http://json-schema.org/draft-01/hyper-schema#", ""); // References diff --git a/test/jsonschema/jsonschema_frame_draft2_test.cc b/test/jsonschema/jsonschema_frame_draft2_test.cc index d3dd4a361..a83c2c697 100644 --- a/test/jsonschema/jsonschema_frame_draft2_test.cc +++ b/test/jsonschema/jsonschema_frame_draft2_test.cc @@ -8,32 +8,30 @@ #define EXPECT_FRAME_STATIC_DRAFT2_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-02/schema#", \ "http://json-schema.org/draft-02/hyper-schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-02/schema#", \ "http://json-schema.org/draft-02/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); #define EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-02/schema#", \ "http://json-schema.org/draft-02/hyper-schema#", expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent); + expected_relative_pointer, expected_parent); TEST(JSONSchema_frame_draft2, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -42,7 +40,7 @@ TEST(JSONSchema_frame_draft2, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -51,32 +49,28 @@ TEST(JSONSchema_frame_draft2, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-02/hyper-schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/id", "/additionalProperties/id", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-02/hyper-schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-02/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {}, ""); + "http://json-schema.org/draft-02/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-02/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/id", "/additionalProperties/id", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {}, - "/additionalProperties"); + "http://json-schema.org/draft-02/hyper-schema#", "/additionalProperties"); // References @@ -95,7 +89,7 @@ TEST(JSONSchema_frame_draft2, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -103,18 +97,18 @@ TEST(JSONSchema_frame_draft2, empty_schema) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -133,7 +127,7 @@ TEST(JSONSchema_frame_draft2, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -141,18 +135,18 @@ TEST(JSONSchema_frame_draft2, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -175,7 +169,7 @@ TEST(JSONSchema_frame_draft2, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -183,38 +177,38 @@ TEST(JSONSchema_frame_draft2, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -235,7 +229,7 @@ TEST(JSONSchema_frame_draft2, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -243,42 +237,42 @@ TEST(JSONSchema_frame_draft2, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT2_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/test/qux#/id", "https://www.sourcemeta.com/test/qux", "/id", - "https://www.sourcemeta.com/test/qux", "/id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -301,7 +295,7 @@ TEST(JSONSchema_frame_draft2, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -309,42 +303,42 @@ TEST(JSONSchema_frame_draft2, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT2_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/items/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -364,7 +358,7 @@ TEST(JSONSchema_frame_draft2, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -377,7 +371,7 @@ TEST(JSONSchema_frame_draft2, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-02/schema#", @@ -387,18 +381,18 @@ TEST(JSONSchema_frame_draft2, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -425,7 +419,7 @@ TEST(JSONSchema_frame_draft2, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-02/schema#", @@ -436,60 +430,59 @@ TEST(JSONSchema_frame_draft2, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT2_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT2_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT2_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/id", "https://www.sourcemeta.com/schema", "/properties/two/id", - "https://www.test.com", "/id", {}, "/properties/two"); + "https://www.test.com", "/id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.sourcemeta.com/test#/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT2_POINTER( frame, "https://www.test.com#/id", "https://www.sourcemeta.com/schema", - "/properties/two/id", "https://www.test.com", "/id", {}, - "/properties/two"); + "/properties/two/id", "https://www.test.com", "/id", "/properties/two"); // References @@ -508,7 +501,7 @@ TEST(JSONSchema_frame_draft2, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -516,13 +509,13 @@ TEST(JSONSchema_frame_draft2, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {""}, std::nullopt); + "http://json-schema.org/draft-02/hyper-schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {}, ""); + "http://json-schema.org/draft-02/hyper-schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-02/schema#", - "http://json-schema.org/draft-02/hyper-schema#", {}, ""); + "http://json-schema.org/draft-02/hyper-schema#", ""); // References diff --git a/test/jsonschema/jsonschema_frame_draft3_test.cc b/test/jsonschema/jsonschema_frame_draft3_test.cc index 6d405313b..fb0c5595f 100644 --- a/test/jsonschema/jsonschema_frame_draft3_test.cc +++ b/test/jsonschema/jsonschema_frame_draft3_test.cc @@ -8,30 +8,30 @@ #define EXPECT_FRAME_STATIC_DRAFT3_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-03/schema#", \ "http://json-schema.org/draft-03/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-03/schema#", \ "http://json-schema.org/draft-03/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-03/schema#", \ "http://json-schema.org/draft-03/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_draft3, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -40,7 +40,7 @@ TEST(JSONSchema_frame_draft3, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -49,30 +49,28 @@ TEST(JSONSchema_frame_draft3, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-03/schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/id", "/additionalProperties/id", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-03/schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-03/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/id", "/additionalProperties/id", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-03/schema#", "/additionalProperties"); // References @@ -91,7 +89,7 @@ TEST(JSONSchema_frame_draft3, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -99,18 +97,18 @@ TEST(JSONSchema_frame_draft3, empty_schema) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -129,7 +127,7 @@ TEST(JSONSchema_frame_draft3, empty_schema_trailing_slash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -137,18 +135,18 @@ TEST(JSONSchema_frame_draft3, empty_schema_trailing_slash) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -171,7 +169,7 @@ TEST(JSONSchema_frame_draft3, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -179,38 +177,38 @@ TEST(JSONSchema_frame_draft3, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -231,7 +229,7 @@ TEST(JSONSchema_frame_draft3, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -239,42 +237,42 @@ TEST(JSONSchema_frame_draft3, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT3_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/test/qux#/id", "https://www.sourcemeta.com/test/qux", "/id", - "https://www.sourcemeta.com/test/qux", "/id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -297,7 +295,7 @@ TEST(JSONSchema_frame_draft3, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -305,42 +303,42 @@ TEST(JSONSchema_frame_draft3, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT3_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/items/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -360,7 +358,7 @@ TEST(JSONSchema_frame_draft3, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -373,7 +371,7 @@ TEST(JSONSchema_frame_draft3, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-03/schema#", @@ -383,18 +381,18 @@ TEST(JSONSchema_frame_draft3, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -421,7 +419,7 @@ TEST(JSONSchema_frame_draft3, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-03/schema#", @@ -432,60 +430,59 @@ TEST(JSONSchema_frame_draft3, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT3_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/id", "https://www.sourcemeta.com/schema", "/properties/two/id", - "https://www.test.com", "/id", {}, "/properties/two"); + "https://www.test.com", "/id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.sourcemeta.com/test#/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://www.test.com#/id", "https://www.sourcemeta.com/schema", - "/properties/two/id", "https://www.test.com", "/id", {}, - "/properties/two"); + "/properties/two/id", "https://www.test.com", "/id", "/properties/two"); // References @@ -504,7 +501,7 @@ TEST(JSONSchema_frame_draft3, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -512,13 +509,13 @@ TEST(JSONSchema_frame_draft3, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-03/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); // References @@ -542,7 +539,7 @@ TEST(JSONSchema_frame_draft3, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -556,17 +553,17 @@ TEST(JSONSchema_frame_draft3, ref_with_id) { // so we do know about the dialect anyway EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-03/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/id", "/id", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); // References @@ -588,7 +585,7 @@ TEST(JSONSchema_frame_draft3, top_level_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -597,16 +594,16 @@ TEST(JSONSchema_frame_draft3, top_level_relative_ref_with_id) { // Note that `id` is IGNORED given the sibling `$ref` EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-03/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/id", "/id", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-03/schema#", - "http://json-schema.org/draft-03/schema#", {}, ""); + "http://json-schema.org/draft-03/schema#", ""); EXPECT_EQ(frame.references().size(), 2); @@ -628,33 +625,33 @@ TEST(JSONSchema_frame_draft3, nested_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 6); - EXPECT_FRAME_STATIC_DRAFT3_RESOURCE( - frame, "https://example.com", "https://example.com", "", - "https://example.com", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_DRAFT3_RESOURCE(frame, "https://example.com", + "https://example.com", "", + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT3_POINTER(frame, "https://example.com#/id", "https://example.com", "/id", - "https://example.com", "/id", {}, ""); + "https://example.com", "/id", ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER(frame, "https://example.com#/$schema", "https://example.com", "/$schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT3_SUBSCHEMA( frame, "https://example.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://example.com", "/additionalProperties", - {"/~?additionalProperties~/~P~"}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://example.com#/additionalProperties/id", "https://example.com", "/additionalProperties/id", "https://example.com", - "/additionalProperties/id", {}, "/additionalProperties"); + "/additionalProperties/id", "/additionalProperties"); EXPECT_FRAME_STATIC_DRAFT3_POINTER( frame, "https://example.com#/additionalProperties/$ref", "https://example.com", "/additionalProperties/$ref", - "https://example.com", "/additionalProperties/$ref", {}, + "https://example.com", "/additionalProperties/$ref", "/additionalProperties"); EXPECT_EQ(frame.references().size(), 2); diff --git a/test/jsonschema/jsonschema_frame_draft4_test.cc b/test/jsonschema/jsonschema_frame_draft4_test.cc index f1e1abe77..a4537b034 100644 --- a/test/jsonschema/jsonschema_frame_draft4_test.cc +++ b/test/jsonschema/jsonschema_frame_draft4_test.cc @@ -8,39 +8,39 @@ #define EXPECT_FRAME_STATIC_DRAFT4_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-04/schema#", \ "http://json-schema.org/draft-04/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-04/schema#", \ "http://json-schema.org/draft-04/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT4_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-04/schema#", \ "http://json-schema.org/draft-04/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-04/schema#", \ "http://json-schema.org/draft-04/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_draft4, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -49,7 +49,7 @@ TEST(JSONSchema_frame_draft4, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -58,30 +58,28 @@ TEST(JSONSchema_frame_draft4, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-04/schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/id", "/additionalProperties/id", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-04/schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/id", "/additionalProperties/id", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-04/schema#", "/additionalProperties"); // References @@ -100,7 +98,7 @@ TEST(JSONSchema_frame_draft4, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -108,18 +106,18 @@ TEST(JSONSchema_frame_draft4, empty_schema) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -138,7 +136,7 @@ TEST(JSONSchema_frame_draft4, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -146,18 +144,18 @@ TEST(JSONSchema_frame_draft4, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -180,7 +178,7 @@ TEST(JSONSchema_frame_draft4, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -188,38 +186,38 @@ TEST(JSONSchema_frame_draft4, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -240,7 +238,7 @@ TEST(JSONSchema_frame_draft4, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -248,42 +246,42 @@ TEST(JSONSchema_frame_draft4, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/test/qux#/id", "https://www.sourcemeta.com/test/qux", "/id", - "https://www.sourcemeta.com/test/qux", "/id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test/qux", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -306,7 +304,7 @@ TEST(JSONSchema_frame_draft4, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -314,42 +312,42 @@ TEST(JSONSchema_frame_draft4, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/items/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/schema", "/items/id", - "https://www.sourcemeta.com/foo", "/id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/id", "/items"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -369,7 +367,7 @@ TEST(JSONSchema_frame_draft4, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -382,7 +380,7 @@ TEST(JSONSchema_frame_draft4, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-04/schema#", @@ -392,18 +390,18 @@ TEST(JSONSchema_frame_draft4, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -430,7 +428,7 @@ TEST(JSONSchema_frame_draft4, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-04/schema#", @@ -441,60 +439,59 @@ TEST(JSONSchema_frame_draft4, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/id", "https://www.sourcemeta.com/schema", "/properties/two/id", - "https://www.test.com", "/id", {}, "/properties/two"); + "https://www.test.com", "/id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/test#/id", "https://www.sourcemeta.com/schema", "/properties/one/id", - "https://www.sourcemeta.com/test", "/id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.test.com#/id", "https://www.sourcemeta.com/schema", - "/properties/two/id", "https://www.test.com", "/id", {}, - "/properties/two"); + "/properties/two/id", "https://www.test.com", "/id", "/properties/two"); // References @@ -513,7 +510,7 @@ TEST(JSONSchema_frame_draft4, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -521,13 +518,13 @@ TEST(JSONSchema_frame_draft4, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); // References @@ -557,7 +554,7 @@ TEST(JSONSchema_frame_draft4, location_independent_identifier_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -566,40 +563,40 @@ TEST(JSONSchema_frame_draft4, location_independent_identifier_anonymous) { // Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); // Foo EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/foo", "/definitions/foo", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/foo/id", "/definitions/foo/id", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/definitions/foo"); + "http://json-schema.org/draft-04/schema#", "/definitions/foo"); // Bar EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/bar", "/definitions/bar", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/bar/$ref", "/definitions/bar/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/definitions/bar"); + "http://json-schema.org/draft-04/schema#", "/definitions/bar"); // Anchors EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#foo", "/definitions/foo", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); // References @@ -624,7 +621,7 @@ TEST(JSONSchema_frame_draft4, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -638,29 +635,29 @@ TEST(JSONSchema_frame_draft4, ref_with_id) { // so we do know about the dialect anyway EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/id", "/id", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string", "/definitions/string", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string/type", "/definitions/string/type", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); // References @@ -686,7 +683,7 @@ TEST(JSONSchema_frame_draft4, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, // Note that this is intentionally non-canonical @@ -697,33 +694,32 @@ TEST(JSONSchema_frame_draft4, EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/id", "https://www.sourcemeta.com/schema", "/id", - "https://www.sourcemeta.com/schema", "/id", {}, ""); + "https://www.sourcemeta.com/schema", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/$ref", "https://www.sourcemeta.com/schema", "/properties/foo/$ref", - "https://www.sourcemeta.com/schema", "/properties/foo/$ref", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/$ref", "/properties/foo"); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/bar", "https://www.sourcemeta.com/schema", "/properties/bar", - "https://www.sourcemeta.com/schema", "/properties/bar", - POINTER_TEMPLATES("/bar", "/foo"), ""); + "https://www.sourcemeta.com/schema", "/properties/bar", ""); // References @@ -746,21 +742,21 @@ TEST(JSONSchema_frame_draft4, relative_base_uri_without_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/id", "common", "/id", - "common", "/id", {}, ""); + "common", "/id", ""); // References @@ -785,43 +781,42 @@ TEST(JSONSchema_frame_draft4, relative_base_uri_with_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 10); EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // Anchors EXPECT_FRAME_STATIC_DRAFT4_ANCHOR(frame, "common#foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); + "/definitions/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/id", "common", "/id", - "common", "/id", {}, ""); + "common", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/allOf", "common", "/allOf", - "common", "/allOf", {}, ""); + "common", "/allOf", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA(frame, "common#/allOf/0", "common", - "/allOf/0", "common", "/allOf/0", {""}, - ""); + "/allOf/0", "common", "/allOf/0", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/allOf/0/$ref", "common", "/allOf/0/$ref", "common", "/allOf/0/$ref", - {}, "/allOf/0"); + "/allOf/0"); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/definitions", "common", "/definitions", "common", "/definitions", - {}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA(frame, "common#/definitions/foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); - EXPECT_FRAME_STATIC_DRAFT4_POINTER( - frame, "common#/definitions/foo/id", "common", "/definitions/foo/id", - "common", "/definitions/foo/id", {}, "/definitions/foo"); + "/definitions/foo", ""); + EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "common#/definitions/foo/id", + "common", "/definitions/foo/id", "common", + "/definitions/foo/id", "/definitions/foo"); // References @@ -842,20 +837,20 @@ TEST(JSONSchema_frame_draft4, ref_with_invalid_type) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_EQ(frame.references().size(), 1); EXPECT_STATIC_REFERENCE( @@ -883,7 +878,7 @@ TEST(JSONSchema_frame_draft4, ref_invalidates_sibling_subschemas_and_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -891,46 +886,46 @@ TEST(JSONSchema_frame_draft4, ref_invalidates_sibling_subschemas_and_refs) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {"/foo"}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties", "/properties/foo/properties", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar", "/properties/foo/properties/bar", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/$ref", "/properties/foo/properties/bar/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties", "/properties/foo/properties/bar/additionalProperties", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties/$ref", "/properties/foo/properties/bar/additionalProperties/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-04/schema#", "/properties/foo"); EXPECT_EQ(frame.references().size(), 2); @@ -951,7 +946,7 @@ TEST(JSONSchema_frame_draft4, top_level_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -960,16 +955,16 @@ TEST(JSONSchema_frame_draft4, top_level_relative_ref_with_id) { // Note that `id` is IGNORED given the sibling `$ref` EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-04/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/id", "/id", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", {}, ""); + "http://json-schema.org/draft-04/schema#", ""); EXPECT_EQ(frame.references().size(), 2); @@ -991,33 +986,33 @@ TEST(JSONSchema_frame_draft4, nested_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 6); - EXPECT_FRAME_STATIC_DRAFT4_RESOURCE( - frame, "https://example.com", "https://example.com", "", - "https://example.com", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_DRAFT4_RESOURCE(frame, "https://example.com", + "https://example.com", "", + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "https://example.com#/id", "https://example.com", "/id", - "https://example.com", "/id", {}, ""); + "https://example.com", "/id", ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER(frame, "https://example.com#/$schema", "https://example.com", "/$schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT4_SUBSCHEMA( frame, "https://example.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://example.com", "/additionalProperties", - {"/~?additionalProperties~/~P~"}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://example.com#/additionalProperties/id", "https://example.com", "/additionalProperties/id", "https://example.com", - "/additionalProperties/id", {}, "/additionalProperties"); + "/additionalProperties/id", "/additionalProperties"); EXPECT_FRAME_STATIC_DRAFT4_POINTER( frame, "https://example.com#/additionalProperties/$ref", "https://example.com", "/additionalProperties/$ref", - "https://example.com", "/additionalProperties/$ref", {}, + "https://example.com", "/additionalProperties/$ref", "/additionalProperties"); EXPECT_EQ(frame.references().size(), 2); diff --git a/test/jsonschema/jsonschema_frame_draft6_test.cc b/test/jsonschema/jsonschema_frame_draft6_test.cc index 26047dce0..f86e0bbcf 100644 --- a/test/jsonschema/jsonschema_frame_draft6_test.cc +++ b/test/jsonschema/jsonschema_frame_draft6_test.cc @@ -8,39 +8,39 @@ #define EXPECT_FRAME_STATIC_DRAFT6_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-06/schema#", \ "http://json-schema.org/draft-06/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-06/schema#", \ "http://json-schema.org/draft-06/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT6_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-06/schema#", \ "http://json-schema.org/draft-06/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-06/schema#", \ "http://json-schema.org/draft-06/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_draft6, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -49,7 +49,7 @@ TEST(JSONSchema_frame_draft6, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -58,30 +58,28 @@ TEST(JSONSchema_frame_draft6, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalProperties/$id", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-06/schema#", "/additionalProperties"); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/$id", "/additionalProperties/$id", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-06/schema#", "/additionalProperties"); // References @@ -100,7 +98,7 @@ TEST(JSONSchema_frame_draft6, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -108,18 +106,18 @@ TEST(JSONSchema_frame_draft6, empty_schema) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -138,7 +136,7 @@ TEST(JSONSchema_frame_draft6, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -146,18 +144,18 @@ TEST(JSONSchema_frame_draft6, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -180,7 +178,7 @@ TEST(JSONSchema_frame_draft6, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -188,38 +186,38 @@ TEST(JSONSchema_frame_draft6, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -240,7 +238,7 @@ TEST(JSONSchema_frame_draft6, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -248,42 +246,42 @@ TEST(JSONSchema_frame_draft6, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$id", "https://www.sourcemeta.com/test/qux", "/$id", - "https://www.sourcemeta.com/test/qux", "/$id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -306,7 +304,7 @@ TEST(JSONSchema_frame_draft6, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -314,42 +312,42 @@ TEST(JSONSchema_frame_draft6, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -369,7 +367,7 @@ TEST(JSONSchema_frame_draft6, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -382,7 +380,7 @@ TEST(JSONSchema_frame_draft6, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-06/schema#", @@ -392,18 +390,18 @@ TEST(JSONSchema_frame_draft6, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -430,7 +428,7 @@ TEST(JSONSchema_frame_draft6, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-06/schema#", @@ -441,60 +439,59 @@ TEST(JSONSchema_frame_draft6, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$id", "https://www.sourcemeta.com/schema", "/properties/two/$id", - "https://www.test.com", "/$id", {}, "/properties/two"); + "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.sourcemeta.com/test#/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://www.test.com#/$id", "https://www.sourcemeta.com/schema", - "/properties/two/$id", "https://www.test.com", "/$id", {}, - "/properties/two"); + "/properties/two/$id", "https://www.test.com", "/$id", "/properties/two"); // References @@ -513,7 +510,7 @@ TEST(JSONSchema_frame_draft6, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -521,13 +518,13 @@ TEST(JSONSchema_frame_draft6, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); // References @@ -557,7 +554,7 @@ TEST(JSONSchema_frame_draft6, location_independent_identifier_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -566,40 +563,40 @@ TEST(JSONSchema_frame_draft6, location_independent_identifier_anonymous) { // Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); // Foo EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/foo", "/definitions/foo", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/foo/$id", "/definitions/foo/$id", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/definitions/foo"); + "http://json-schema.org/draft-06/schema#", "/definitions/foo"); // Bar EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/bar", "/definitions/bar", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/bar/$ref", "/definitions/bar/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/definitions/bar"); + "http://json-schema.org/draft-06/schema#", "/definitions/bar"); // Anchors EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#foo", "/definitions/foo", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); // References @@ -624,7 +621,7 @@ TEST(JSONSchema_frame_draft6, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -638,29 +635,29 @@ TEST(JSONSchema_frame_draft6, ref_with_id) { // so we do know about the dialect anyway EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$id", "/$id", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string", "/definitions/string", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string/type", "/definitions/string/type", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); // References @@ -681,21 +678,21 @@ TEST(JSONSchema_frame_draft6, relative_base_uri_without_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); // References @@ -720,43 +717,42 @@ TEST(JSONSchema_frame_draft6, relative_base_uri_with_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 10); EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // Anchors EXPECT_FRAME_STATIC_DRAFT6_ANCHOR(frame, "common#foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); + "/definitions/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/allOf", "common", "/allOf", - "common", "/allOf", {}, ""); + "common", "/allOf", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA(frame, "common#/allOf/0", "common", - "/allOf/0", "common", "/allOf/0", {""}, - ""); + "/allOf/0", "common", "/allOf/0", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/allOf/0/$ref", "common", "/allOf/0/$ref", "common", "/allOf/0/$ref", - {}, "/allOf/0"); + "/allOf/0"); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "common#/definitions", "common", "/definitions", "common", "/definitions", - {}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA(frame, "common#/definitions/foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); + "/definitions/foo", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "common#/definitions/foo/$id", "common", "/definitions/foo/$id", - "common", "/definitions/foo/$id", {}, "/definitions/foo"); + "common", "/definitions/foo/$id", "/definitions/foo"); // References @@ -789,7 +785,7 @@ TEST(JSONSchema_frame_draft6, ref_invalidates_sibling_subschemas_and_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -797,46 +793,46 @@ TEST(JSONSchema_frame_draft6, ref_invalidates_sibling_subschemas_and_refs) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {"/foo"}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties", "/properties/foo/properties", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar", "/properties/foo/properties/bar", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/$ref", "/properties/foo/properties/bar/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties", "/properties/foo/properties/bar/additionalProperties", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties/$ref", "/properties/foo/properties/bar/additionalProperties/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-06/schema#", "/properties/foo"); EXPECT_EQ(frame.references().size(), 2); @@ -857,7 +853,7 @@ TEST(JSONSchema_frame_draft6, top_level_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -866,16 +862,16 @@ TEST(JSONSchema_frame_draft6, top_level_relative_ref_with_id) { // Note that `$id` is IGNORED given the sibling `$ref` EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-06/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$id", "/$id", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-06/schema#", - "http://json-schema.org/draft-06/schema#", {}, ""); + "http://json-schema.org/draft-06/schema#", ""); EXPECT_EQ(frame.references().size(), 2); @@ -897,33 +893,33 @@ TEST(JSONSchema_frame_draft6, nested_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 6); - EXPECT_FRAME_STATIC_DRAFT6_RESOURCE( - frame, "https://example.com", "https://example.com", "", - "https://example.com", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_DRAFT6_RESOURCE(frame, "https://example.com", + "https://example.com", "", + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "https://example.com#/$id", "https://example.com", "/$id", - "https://example.com", "/$id", {}, ""); + "https://example.com", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER(frame, "https://example.com#/$schema", "https://example.com", "/$schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT6_SUBSCHEMA( frame, "https://example.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://example.com", "/additionalProperties", - {"/~?additionalProperties~/~P~"}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://example.com#/additionalProperties/$id", "https://example.com", "/additionalProperties/$id", "https://example.com", - "/additionalProperties/$id", {}, "/additionalProperties"); + "/additionalProperties/$id", "/additionalProperties"); EXPECT_FRAME_STATIC_DRAFT6_POINTER( frame, "https://example.com#/additionalProperties/$ref", "https://example.com", "/additionalProperties/$ref", - "https://example.com", "/additionalProperties/$ref", {}, + "https://example.com", "/additionalProperties/$ref", "/additionalProperties"); EXPECT_EQ(frame.references().size(), 2); diff --git a/test/jsonschema/jsonschema_frame_draft7_test.cc b/test/jsonschema/jsonschema_frame_draft7_test.cc index 6350c3a98..47efbbd8b 100644 --- a/test/jsonschema/jsonschema_frame_draft7_test.cc +++ b/test/jsonschema/jsonschema_frame_draft7_test.cc @@ -8,39 +8,39 @@ #define EXPECT_FRAME_STATIC_DRAFT7_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_POINTER(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-07/schema#", \ "http://json-schema.org/draft-07/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_RESOURCE(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-07/schema#", \ "http://json-schema.org/draft-07/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT7_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-07/schema#", \ "http://json-schema.org/draft-07/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); #define EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC_SUBSCHEMA(frame, reference, root_id, expected_pointer, \ "http://json-schema.org/draft-07/schema#", \ "http://json-schema.org/draft-07/schema#", \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent); + expected_parent); TEST(JSONSchema_frame_draft7, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ @@ -49,7 +49,7 @@ TEST(JSONSchema_frame_draft7, anonymous_with_nested_schema_resource) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -58,30 +58,28 @@ TEST(JSONSchema_frame_draft7, anonymous_with_nested_schema_resource) { EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/additionalProperties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-07/schema#", ""); // JSON Pointers EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/additionalProperties/$id", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-07/schema#", "/additionalProperties"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/additionalProperties", "/additionalProperties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", - {"/~?additionalProperties~/~P~"}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/additionalProperties/$id", "/additionalProperties/$id", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/additionalProperties"); + "http://json-schema.org/draft-07/schema#", "/additionalProperties"); // References @@ -100,7 +98,7 @@ TEST(JSONSchema_frame_draft7, empty_schema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -108,18 +106,18 @@ TEST(JSONSchema_frame_draft7, empty_schema) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -138,7 +136,7 @@ TEST(JSONSchema_frame_draft7, empty_schema_trailing_hash) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -146,18 +144,18 @@ TEST(JSONSchema_frame_draft7, empty_schema_trailing_hash) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -180,7 +178,7 @@ TEST(JSONSchema_frame_draft7, one_level_applicators_without_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -188,38 +186,38 @@ TEST(JSONSchema_frame_draft7, one_level_applicators_without_identifiers) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/schema", "/items", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/foo", "https://www.sourcemeta.com/schema", "/properties/foo", - "https://www.sourcemeta.com/schema", "/properties/foo", {"/foo"}, ""); + "https://www.sourcemeta.com/schema", "/properties/foo", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/foo/type", "https://www.sourcemeta.com/schema", "/properties/foo/type", - "https://www.sourcemeta.com/schema", "/properties/foo/type", {}, + "https://www.sourcemeta.com/schema", "/properties/foo/type", "/properties/foo"); // References @@ -240,7 +238,7 @@ TEST(JSONSchema_frame_draft7, one_level_applicators_with_identifiers) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -248,42 +246,42 @@ TEST(JSONSchema_frame_draft7, one_level_applicators_with_identifiers) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/test/qux", "https://www.sourcemeta.com/test/qux", "", - "https://www.sourcemeta.com/test/qux", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/test/qux", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/test/qux", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$id", "https://www.sourcemeta.com/test/qux", "/$id", - "https://www.sourcemeta.com/test/qux", "/$id", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/test/qux#/$schema", "https://www.sourcemeta.com/test/qux", "/$schema", - "https://www.sourcemeta.com/test/qux", "/$schema", {}, ""); + "https://www.sourcemeta.com/test/qux", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/test/qux#/items", "https://www.sourcemeta.com/test/qux", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/test/qux#/items/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/test/qux", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/test/qux", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -306,7 +304,7 @@ TEST(JSONSchema_frame_draft7, subschema_absolute_identifier) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -314,42 +312,42 @@ TEST(JSONSchema_frame_draft7, subschema_absolute_identifier) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( - frame, "https://www.sourcemeta.com/foo", - "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "https://www.sourcemeta.com/foo", + "https://www.sourcemeta.com/schema", + "/items", + "https://www.sourcemeta.com/foo", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", - "https://www.sourcemeta.com/foo", "", {"/~I~"}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/items/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/foo#/$id", "https://www.sourcemeta.com/schema", "/items/$id", - "https://www.sourcemeta.com/foo", "/$id", {}, "/items"); + "https://www.sourcemeta.com/foo", "/$id", "/items"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/foo#/type", "https://www.sourcemeta.com/schema", "/items/type", - "https://www.sourcemeta.com/foo", "/type", {}, "/items"); + "https://www.sourcemeta.com/foo", "/type", "/items"); // References @@ -369,7 +367,7 @@ TEST(JSONSchema_frame_draft7, id_override) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaFrameError); @@ -382,7 +380,7 @@ TEST(JSONSchema_frame_draft7, explicit_argument_id_same) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-07/schema#", @@ -392,18 +390,18 @@ TEST(JSONSchema_frame_draft7, explicit_argument_id_same) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); // References @@ -430,7 +428,7 @@ TEST(JSONSchema_frame_draft7, explicit_argument_id_different) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "http://json-schema.org/draft-07/schema#", @@ -441,60 +439,59 @@ TEST(JSONSchema_frame_draft7, explicit_argument_id_different) { EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/schema", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.sourcemeta.com/test", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.example.com", "https://www.sourcemeta.com/schema", "", - "https://www.sourcemeta.com/schema", "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( - frame, "https://www.example.com/test", - "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.example.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/schema", "", std::nullopt); + EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "https://www.example.com/test", + "https://www.sourcemeta.com/schema", + "/properties/one", + "https://www.example.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( frame, "https://www.test.com", "https://www.sourcemeta.com/schema", - "/properties/two", "https://www.test.com", "", {"/two"}, ""); + "/properties/two", "https://www.test.com", "", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$id", "https://www.sourcemeta.com/schema", "/$id", - "https://www.sourcemeta.com/schema", "/$id", {}, ""); + "https://www.sourcemeta.com/schema", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/properties", "https://www.sourcemeta.com/schema", "/properties", - "https://www.sourcemeta.com/schema", "/properties", {}, ""); + "https://www.sourcemeta.com/schema", "/properties", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/one", "https://www.sourcemeta.com/schema", "/properties/one", - "https://www.sourcemeta.com/test", "", {"/one"}, ""); + "https://www.sourcemeta.com/test", "", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/one/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/properties/two", "https://www.sourcemeta.com/schema", "/properties/two", - "https://www.test.com", "", {"/two"}, ""); + "https://www.test.com", "", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/schema#/properties/two/$id", "https://www.sourcemeta.com/schema", "/properties/two/$id", - "https://www.test.com", "/$id", {}, "/properties/two"); + "https://www.test.com", "/$id", "/properties/two"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.sourcemeta.com/test#/$id", "https://www.sourcemeta.com/schema", "/properties/one/$id", - "https://www.sourcemeta.com/test", "/$id", {}, "/properties/one"); + "https://www.sourcemeta.com/test", "/$id", "/properties/one"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://www.test.com#/$id", "https://www.sourcemeta.com/schema", - "/properties/two/$id", "https://www.test.com", "/$id", {}, - "/properties/two"); + "/properties/two/$id", "https://www.test.com", "/$id", "/properties/two"); // References @@ -513,7 +510,7 @@ TEST(JSONSchema_frame_draft7, ref_metaschema) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -521,13 +518,13 @@ TEST(JSONSchema_frame_draft7, ref_metaschema) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // References @@ -557,7 +554,7 @@ TEST(JSONSchema_frame_draft7, location_independent_identifier_anonymous) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -566,40 +563,40 @@ TEST(JSONSchema_frame_draft7, location_independent_identifier_anonymous) { // Pointers EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // Foo EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/foo", "/definitions/foo", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/foo/$id", "/definitions/foo/$id", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/definitions/foo"); + "http://json-schema.org/draft-07/schema#", "/definitions/foo"); // Bar EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/bar", "/definitions/bar", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/bar/$ref", "/definitions/bar/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/definitions/bar"); + "http://json-schema.org/draft-07/schema#", "/definitions/bar"); // Anchors EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#foo", "/definitions/foo", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // References @@ -624,7 +621,7 @@ TEST(JSONSchema_frame_draft7, ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -638,29 +635,29 @@ TEST(JSONSchema_frame_draft7, ref_with_id) { // so we do know about the dialect anyway EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$id", "/$id", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string", "/definitions/string", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string/type", "/definitions/string/type", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // References @@ -684,7 +681,7 @@ TEST(JSONSchema_frame_draft7, ref_with_definitions) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -694,28 +691,28 @@ TEST(JSONSchema_frame_draft7, ref_with_definitions) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // Note that this is NOT considered to be a subschema, as `$ref` overrides it EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string", "/definitions/string", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/string/type", "/definitions/string/type", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // References @@ -739,7 +736,7 @@ TEST(JSONSchema_frame_draft7, ref_with_properties) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -749,25 +746,25 @@ TEST(JSONSchema_frame_draft7, ref_with_properties) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/string", "/properties/string", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/string/type", "/properties/string/type", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // References @@ -788,21 +785,21 @@ TEST(JSONSchema_frame_draft7, relative_base_uri_without_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 3); EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); // References @@ -827,43 +824,42 @@ TEST(JSONSchema_frame_draft7, relative_base_uri_with_ref) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 10); EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "common", "common", "", "common", - "", {""}, std::nullopt); + "", std::nullopt); // Anchors EXPECT_FRAME_STATIC_DRAFT7_ANCHOR(frame, "common#foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); + "/definitions/foo", ""); // JSON Pointers EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/$schema", "common", - "/$schema", "common", "/$schema", {}, ""); + "/$schema", "common", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/$id", "common", "/$id", - "common", "/$id", {}, ""); + "common", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/allOf", "common", "/allOf", - "common", "/allOf", {}, ""); + "common", "/allOf", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA(frame, "common#/allOf/0", "common", - "/allOf/0", "common", "/allOf/0", {""}, - ""); + "/allOf/0", "common", "/allOf/0", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/allOf/0/$ref", "common", "/allOf/0/$ref", "common", "/allOf/0/$ref", - {}, "/allOf/0"); + "/allOf/0"); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "common#/definitions", "common", "/definitions", "common", "/definitions", - {}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA(frame, "common#/definitions/foo", "common", "/definitions/foo", "common", - "/definitions/foo", {""}, ""); + "/definitions/foo", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "common#/definitions/foo/$id", "common", "/definitions/foo/$id", - "common", "/definitions/foo/$id", {}, "/definitions/foo"); + "common", "/definitions/foo/$id", "/definitions/foo"); // References @@ -896,7 +892,7 @@ TEST(JSONSchema_frame_draft7, ref_invalidates_sibling_subschemas_and_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -904,46 +900,46 @@ TEST(JSONSchema_frame_draft7, ref_invalidates_sibling_subschemas_and_refs) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {"/foo"}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$ref", "/properties/foo/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties", "/properties/foo/properties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar", "/properties/foo/properties/bar", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/$ref", "/properties/foo/properties/bar/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties", "/properties/foo/properties/bar/additionalProperties", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/properties/bar/additionalProperties/$ref", "/properties/foo/properties/bar/additionalProperties/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/properties/foo"); + "http://json-schema.org/draft-07/schema#", "/properties/foo"); EXPECT_EQ(frame.references().size(), 2); @@ -964,7 +960,7 @@ TEST(JSONSchema_frame_draft7, top_level_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -973,16 +969,16 @@ TEST(JSONSchema_frame_draft7, top_level_relative_ref_with_id) { // Note that `$id` is IGNORED given the sibling `$ref` EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {""}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$id", "/$id", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$ref", "/$ref", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_EQ(frame.references().size(), 2); @@ -1004,33 +1000,33 @@ TEST(JSONSchema_frame_draft7, nested_relative_ref_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 6); - EXPECT_FRAME_STATIC_DRAFT7_RESOURCE( - frame, "https://example.com", "https://example.com", "", - "https://example.com", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_DRAFT7_RESOURCE(frame, "https://example.com", + "https://example.com", "", + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "https://example.com#/$id", "https://example.com", "/$id", - "https://example.com", "/$id", {}, ""); + "https://example.com", "/$id", ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER(frame, "https://example.com#/$schema", "https://example.com", "/$schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_DRAFT7_SUBSCHEMA( frame, "https://example.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://example.com", "/additionalProperties", - {"/~?additionalProperties~/~P~"}, ""); + ""); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://example.com#/additionalProperties/$id", "https://example.com", "/additionalProperties/$id", "https://example.com", - "/additionalProperties/$id", {}, "/additionalProperties"); + "/additionalProperties/$id", "/additionalProperties"); EXPECT_FRAME_STATIC_DRAFT7_POINTER( frame, "https://example.com#/additionalProperties/$ref", "https://example.com", "/additionalProperties/$ref", - "https://example.com", "/additionalProperties/$ref", {}, + "https://example.com", "/additionalProperties/$ref", "/additionalProperties"); EXPECT_EQ(frame.references().size(), 2); diff --git a/test/jsonschema/jsonschema_frame_test.cc b/test/jsonschema/jsonschema_frame_test.cc index 3957f59d6..fa52e8d3b 100644 --- a/test/jsonschema/jsonschema_frame_test.cc +++ b/test/jsonschema/jsonschema_frame_test.cc @@ -28,7 +28,7 @@ TEST(JSONSchema_frame, nested_schemas_mixing_dialects) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -38,19 +38,19 @@ TEST(JSONSchema_frame, nested_schemas_mixing_dialects) { "https://www.sourcemeta.com/test", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/test", "", {""}, + "https://www.sourcemeta.com/test", "", std::nullopt); EXPECT_FRAME_STATIC_RESOURCE(frame, "https://www.sourcemeta.com/foo", "https://www.sourcemeta.com/test", "/$defs/foo", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "", {}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_RESOURCE( frame, "https://www.sourcemeta.com/bar", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "", {}, "/$defs/foo"); + "https://www.sourcemeta.com/bar", "", "/$defs/foo"); // JSON Pointers @@ -58,116 +58,108 @@ TEST(JSONSchema_frame, nested_schemas_mixing_dialects) { "https://www.sourcemeta.com/test", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/test", "/$id", {}, - ""); + "https://www.sourcemeta.com/test", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.sourcemeta.com/test#/$schema", "https://www.sourcemeta.com/test", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/test", "/$schema", {}, + "https://www.sourcemeta.com/test", "/$schema", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.sourcemeta.com/test#/$defs", "https://www.sourcemeta.com/test", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/test", "/$defs", {}, - ""); + "https://www.sourcemeta.com/test", "/$defs", ""); EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.sourcemeta.com/test#/$defs/foo", "https://www.sourcemeta.com/test", "/$defs/foo", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "", {}, ""); + "https://www.sourcemeta.com/foo", "", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/test#/$defs/foo/id", "https://www.sourcemeta.com/test", "/$defs/foo/id", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/id", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/id", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/test#/$defs/foo/$schema", "https://www.sourcemeta.com/test", "/$defs/foo/$schema", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/$schema", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/$schema", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/test#/$defs/foo/definitions", "https://www.sourcemeta.com/test", "/$defs/foo/definitions", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/definitions", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/definitions", "/$defs/foo"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://www.sourcemeta.com/test#/$defs/foo/definitions/bar", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "", {}, "/$defs/foo"); + "https://www.sourcemeta.com/bar", "", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/test#/$defs/foo/definitions/bar/id", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/id", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/id", {}, - "/$defs/foo/definitions/bar"); + "https://www.sourcemeta.com/bar", "/id", "/$defs/foo/definitions/bar"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/test#/$defs/foo/definitions/bar/type", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/type", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/type", {}, - "/$defs/foo/definitions/bar"); + "https://www.sourcemeta.com/bar", "/type", "/$defs/foo/definitions/bar"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/foo#/id", "https://www.sourcemeta.com/test", "/$defs/foo/id", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/id", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/id", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/foo#/$schema", "https://www.sourcemeta.com/test", "/$defs/foo/$schema", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/$schema", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/$schema", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/foo#/definitions", "https://www.sourcemeta.com/test", "/$defs/foo/definitions", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/foo", "/definitions", {}, "/$defs/foo"); + "https://www.sourcemeta.com/foo", "/definitions", "/$defs/foo"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://www.sourcemeta.com/foo#/definitions/bar", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "", {}, "/$defs/foo"); + "https://www.sourcemeta.com/bar", "", "/$defs/foo"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/foo#/definitions/bar/id", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/id", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/id", {}, - "/$defs/foo/definitions/bar"); + "https://www.sourcemeta.com/bar", "/id", "/$defs/foo/definitions/bar"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/foo#/definitions/bar/type", "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/type", "http://json-schema.org/draft-04/schema#", "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/type", {}, - "/$defs/foo/definitions/bar"); - EXPECT_FRAME_STATIC_POINTER(frame, "https://www.sourcemeta.com/bar#/id", - "https://www.sourcemeta.com/test", - "/$defs/foo/definitions/bar/id", - "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/id", {}, - "/$defs/foo/definitions/bar"); - EXPECT_FRAME_STATIC_POINTER(frame, "https://www.sourcemeta.com/bar#/type", - "https://www.sourcemeta.com/test", - "/$defs/foo/definitions/bar/type", - "http://json-schema.org/draft-04/schema#", - "http://json-schema.org/draft-04/schema#", - "https://www.sourcemeta.com/bar", "/type", {}, - "/$defs/foo/definitions/bar"); + "https://www.sourcemeta.com/bar", "/type", "/$defs/foo/definitions/bar"); + EXPECT_FRAME_STATIC_POINTER( + frame, "https://www.sourcemeta.com/bar#/id", + "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/id", + "http://json-schema.org/draft-04/schema#", + "http://json-schema.org/draft-04/schema#", + "https://www.sourcemeta.com/bar", "/id", "/$defs/foo/definitions/bar"); + EXPECT_FRAME_STATIC_POINTER( + frame, "https://www.sourcemeta.com/bar#/type", + "https://www.sourcemeta.com/test", "/$defs/foo/definitions/bar/type", + "http://json-schema.org/draft-04/schema#", + "http://json-schema.org/draft-04/schema#", + "https://www.sourcemeta.com/bar", "/type", "/$defs/foo/definitions/bar"); // References @@ -201,7 +193,7 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -209,11 +201,11 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { // Resources - EXPECT_FRAME_STATIC_RESOURCE( - frame, "https://example.com/main", "https://example.com/main", "", - "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_RESOURCE(frame, "https://example.com/main", + "https://example.com/main", "", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://example.com/main", "", std::nullopt); // JSON Pointers @@ -221,50 +213,50 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { "https://example.com/main", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$schema", {}, ""); + "https://example.com/main", "/$schema", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$id", "https://example.com/main", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$id", {}, ""); + "https://example.com/main", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$ref", "https://example.com/main", "/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$ref", {}, ""); + "https://example.com/main", "/$ref", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$defs", "https://example.com/main", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs", {}, ""); + "https://example.com/main", "/$defs", ""); EXPECT_FRAME_STATIC_RESOURCE(frame, "https://example.com/embedded", "https://example.com/main", "/$defs/embedded", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "", {""}, ""); + "https://example.com/embedded", "", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/$schema", "https://example.com/main", "/$defs/embedded/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$schema", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$schema", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/$id", "https://example.com/main", "/$defs/embedded/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$id", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$id", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/$ref", "https://example.com/main", "/$defs/embedded/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$ref", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$ref", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/definitions", "https://example.com/main", "/$defs/embedded/definitions", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions", {}, "/$defs/embedded"); + "https://example.com/embedded", "/definitions", "/$defs/embedded"); // Note that this is still considered to be a subschema, but a 2020-12 one. // The logic is that we try to interpret it as Draft 7, given `$schema`, but @@ -276,14 +268,13 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { "https://example.com/main", "/$defs/embedded/definitions/foo", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions/foo", {""}, - "/$defs/embedded"); + "https://example.com/embedded", "/definitions/foo", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/definitions/foo/type", "https://example.com/main", "/$defs/embedded/definitions/foo/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions/foo/type", {}, + "https://example.com/embedded", "/definitions/foo/type", "/$defs/embedded/definitions/foo"); // From the root @@ -292,44 +283,43 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { "https://example.com/main", "/$defs/embedded", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "", {""}, ""); + "https://example.com/embedded", "", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$schema", "https://example.com/main", "/$defs/embedded/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$schema", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$schema", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$id", "https://example.com/main", "/$defs/embedded/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$id", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$id", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$ref", "https://example.com/main", "/$defs/embedded/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/$ref", {}, "/$defs/embedded"); + "https://example.com/embedded", "/$ref", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions", "https://example.com/main", "/$defs/embedded/definitions", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions", {}, "/$defs/embedded"); + "https://example.com/embedded", "/definitions", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/main#/$defs/embedded/definitions/foo", "https://example.com/main", "/$defs/embedded/definitions/foo", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions/foo", {""}, - "/$defs/embedded"); + "https://example.com/embedded", "/definitions/foo", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions/foo/type", "https://example.com/main", "/$defs/embedded/definitions/foo/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/embedded", "/definitions/foo/type", {}, + "https://example.com/embedded", "/definitions/foo/type", "/$defs/embedded/definitions/foo"); // References @@ -376,7 +366,7 @@ TEST(JSONSchema_frame, })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -384,11 +374,11 @@ TEST(JSONSchema_frame, // Resources - EXPECT_FRAME_STATIC_RESOURCE( - frame, "https://example.com/main", "https://example.com/main", "", - "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_RESOURCE(frame, "https://example.com/main", + "https://example.com/main", "", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://example.com/main", "", std::nullopt); // JSON Pointers @@ -396,75 +386,75 @@ TEST(JSONSchema_frame, "https://example.com/main", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$schema", {}, ""); + "https://example.com/main", "/$schema", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$id", "https://example.com/main", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$id", {}, ""); + "https://example.com/main", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$ref", "https://example.com/main", "/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$ref", {}, ""); + "https://example.com/main", "/$ref", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$defs", "https://example.com/main", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs", {}, ""); + "https://example.com/main", "/$defs", ""); EXPECT_FRAME_STATIC_RESOURCE(frame, "https://example.com/embedded", "https://example.com/main", "/$defs/embedded", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", - "https://example.com/embedded", "", {""}, ""); + "https://example.com/embedded", "", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/$schema", "https://example.com/main", "/$defs/embedded/$schema", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/$schema", {}, "/$defs/embedded"); + "/$schema", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/$id", "https://example.com/main", "/$defs/embedded/$id", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/$id", {}, "/$defs/embedded"); + "/$id", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/allOf", "https://example.com/main", "/$defs/embedded/allOf", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf", {}, "/$defs/embedded"); + "/allOf", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/embedded#/allOf/0", "https://example.com/main", "/$defs/embedded/allOf/0", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf/0", {""}, "/$defs/embedded"); + "/allOf/0", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/allOf/0/$ref", "https://example.com/main", "/$defs/embedded/allOf/0/$ref", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf/0/$ref", {}, "/$defs/embedded/allOf/0"); + "/allOf/0/$ref", "/$defs/embedded/allOf/0"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/definitions", "https://example.com/main", "/$defs/embedded/definitions", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions", {}, "/$defs/embedded"); + "/definitions", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/embedded#/definitions/foo", "https://example.com/main", "/$defs/embedded/definitions/foo", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions/foo", {""}, "/$defs/embedded"); + "/definitions/foo", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/embedded#/definitions/foo/type", "https://example.com/main", "/$defs/embedded/definitions/foo/type", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions/foo/type", {}, "/$defs/embedded/definitions/foo"); + "/definitions/foo/type", "/$defs/embedded/definitions/foo"); // From the root EXPECT_FRAME_STATIC_SUBSCHEMA(frame, @@ -472,55 +462,55 @@ TEST(JSONSchema_frame, "https://example.com/main", "/$defs/embedded", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", - "https://example.com/embedded", "", {""}, ""); + "https://example.com/embedded", "", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$schema", "https://example.com/main", "/$defs/embedded/$schema", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/$schema", {}, "/$defs/embedded"); + "/$schema", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$id", "https://example.com/main", "/$defs/embedded/$id", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/$id", {}, "/$defs/embedded"); + "/$id", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/allOf", "https://example.com/main", "/$defs/embedded/allOf", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf", {}, "/$defs/embedded"); + "/allOf", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/main#/$defs/embedded/allOf/0", "https://example.com/main", "/$defs/embedded/allOf/0", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf/0", {""}, "/$defs/embedded"); + "/allOf/0", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/allOf/0/$ref", "https://example.com/main", "/$defs/embedded/allOf/0/$ref", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/allOf/0/$ref", {}, "/$defs/embedded/allOf/0"); + "/allOf/0/$ref", "/$defs/embedded/allOf/0"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions", "https://example.com/main", "/$defs/embedded/definitions", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions", {}, "/$defs/embedded"); + "/definitions", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/main#/$defs/embedded/definitions/foo", "https://example.com/main", "/$defs/embedded/definitions/foo", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions/foo", {""}, "/$defs/embedded"); + "/definitions/foo", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions/foo/type", "https://example.com/main", "/$defs/embedded/definitions/foo/type", "http://json-schema.org/draft-07/schema#", "http://json-schema.org/draft-07/schema#", "https://example.com/embedded", - "/definitions/foo/type", {}, "/$defs/embedded/definitions/foo"); + "/definitions/foo/type", "/$defs/embedded/definitions/foo"); // References @@ -562,18 +552,18 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 12); // Resources - EXPECT_FRAME_STATIC_RESOURCE( - frame, "https://example.com/main", "https://example.com/main", "", - "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "", {""}, std::nullopt); + EXPECT_FRAME_STATIC_RESOURCE(frame, "https://example.com/main", + "https://example.com/main", "", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://example.com/main", "", std::nullopt); // JSON Pointers @@ -581,22 +571,22 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { "https://example.com/main", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$schema", {}, ""); + "https://example.com/main", "/$schema", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$id", "https://example.com/main", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$id", {}, ""); + "https://example.com/main", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$ref", "https://example.com/main", "/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$ref", {}, ""); + "https://example.com/main", "/$ref", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com/main#/$defs", "https://example.com/main", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs", {}, ""); + "https://example.com/main", "/$defs", ""); // Note that in this case, we DO NOT consider this to be a resource, as we end // up interpreting it as 2020-12, where `id` is not a valid keyword @@ -605,48 +595,46 @@ TEST(JSONSchema_frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { "https://example.com/main", "/$defs/embedded", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded", {}, ""); + "https://example.com/main", "/$defs/embedded", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$schema", "https://example.com/main", "/$defs/embedded/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/$schema", {}, - "/$defs/embedded"); + "https://example.com/main", "/$defs/embedded/$schema", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/id", "https://example.com/main", "/$defs/embedded/id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/id", {}, "/$defs/embedded"); + "https://example.com/main", "/$defs/embedded/id", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/$ref", "https://example.com/main", "/$defs/embedded/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/$ref", {}, - "/$defs/embedded"); + "https://example.com/main", "/$defs/embedded/$ref", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions", "https://example.com/main", "/$defs/embedded/definitions", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/definitions", {}, + "https://example.com/main", "/$defs/embedded/definitions", "/$defs/embedded"); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com/main#/$defs/embedded/definitions/foo", "https://example.com/main", "/$defs/embedded/definitions/foo", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/definitions/foo", {}, + "https://example.com/main", "/$defs/embedded/definitions/foo", "/$defs/embedded"); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com/main#/$defs/embedded/definitions/foo/type", "https://example.com/main", "/$defs/embedded/definitions/foo/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com/main", "/$defs/embedded/definitions/foo/type", {}, + "https://example.com/main", "/$defs/embedded/definitions/foo/type", "/$defs/embedded/definitions/foo"); // References @@ -690,7 +678,7 @@ TEST(JSONSchema_frame, no_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -700,66 +688,66 @@ TEST(JSONSchema_frame, no_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {""}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties", "/properties", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Foo EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/foo", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/$anchor", "/properties/foo/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/foo/type", "/properties/foo/type", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/foo"); + "https://json-schema.org/draft/2020-12/schema", "/properties/foo"); EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "#foo", "/properties/foo", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/foo"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Bar EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( frame, "https://example.com", "/properties/bar", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/bar"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( frame, "https://example.com#bar", "/properties/bar", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/bar"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$id", "/properties/bar/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/bar"); + "https://json-schema.org/draft/2020-12/schema", "/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "https://example.com#/$anchor", "/properties/bar/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/bar"); + "https://json-schema.org/draft/2020-12/schema", "/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/properties/bar", "/properties/bar", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {"/bar"}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/bar/$id", "/properties/bar/$id", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/bar"); + "https://json-schema.org/draft/2020-12/schema", "/properties/bar"); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/properties/bar/$anchor", "/properties/bar/$anchor", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/properties/bar"); + "https://json-schema.org/draft/2020-12/schema", "/properties/bar"); // References @@ -778,7 +766,7 @@ TEST(JSONSchema_frame, no_id_with_default) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, "https://json-schema.org/draft/2020-12/schema", @@ -789,26 +777,26 @@ TEST(JSONSchema_frame, no_id_with_default) { "https://www.sourcemeta.com/schema", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/schema", "", {""}, + "https://www.sourcemeta.com/schema", "", std::nullopt); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/schema#/$schema", "https://www.sourcemeta.com/schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/schema", "/$schema", {}, ""); + "https://www.sourcemeta.com/schema", "/$schema", ""); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://www.sourcemeta.com/schema#/items", "https://www.sourcemeta.com/schema", "/items", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/schema", "/items", {"/~?items~/~I~"}, ""); + "https://www.sourcemeta.com/schema", "/items", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.sourcemeta.com/schema#/items/type", "https://www.sourcemeta.com/schema", "/items/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.sourcemeta.com/schema", "/items/type", {}, "/items"); + "https://www.sourcemeta.com/schema", "/items/type", "/items"); // References @@ -830,7 +818,7 @@ TEST(JSONSchema_frame, id_with_default_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver, std::nullopt, "https://other.com"); @@ -841,55 +829,55 @@ TEST(JSONSchema_frame, id_with_default_id) { "https://example.com", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "", {""}, std::nullopt); + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com#/$id", "https://example.com", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "/$id", {}, ""); + "https://example.com", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://example.com#/$schema", "https://example.com", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://example.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://example.com", - "/additionalProperties", {"/~?additionalProperties~/~P~"}, ""); + "/additionalProperties", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://example.com#/additionalProperties/type", "https://example.com", "/additionalProperties/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://example.com", - "/additionalProperties/type", {}, "/additionalProperties"); + "/additionalProperties/type", "/additionalProperties"); EXPECT_FRAME_STATIC_RESOURCE(frame, "https://other.com", "https://example.com", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "", {""}, std::nullopt); + "https://example.com", "", std::nullopt); EXPECT_FRAME_STATIC_POINTER(frame, "https://other.com#/$id", "https://example.com", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "/$id", {}, ""); + "https://example.com", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://other.com#/$schema", "https://example.com", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://example.com", "/$schema", {}, ""); + "https://example.com", "/$schema", ""); EXPECT_FRAME_STATIC_SUBSCHEMA( frame, "https://other.com#/additionalProperties", "https://example.com", "/additionalProperties", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://example.com", - "/additionalProperties", {"/~?additionalProperties~/~P~"}, ""); + "/additionalProperties", ""); EXPECT_FRAME_STATIC_POINTER( frame, "https://other.com#/additionalProperties/type", "https://example.com", "/additionalProperties/type", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://example.com", - "/additionalProperties/type", {}, "/additionalProperties"); + "/additionalProperties/type", "/additionalProperties"); // References @@ -922,26 +910,26 @@ TEST(JSONSchema_frame, cross_2020_12_to_2019_09_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Subschema EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); } TEST(JSONSchema_frame, cross_2020_12_to_draft7_without_id) { @@ -965,25 +953,25 @@ TEST(JSONSchema_frame, cross_2020_12_to_draft7_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Note that `$schema` without an identifier is NOT allowed EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); } TEST(JSONSchema_frame, cross_2020_12_to_draft6_without_id) { @@ -1007,25 +995,25 @@ TEST(JSONSchema_frame, cross_2020_12_to_draft6_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Note that `$schema` without an identifier is NOT allowed EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); } TEST(JSONSchema_frame, cross_2020_12_to_draft4_without_id) { @@ -1049,25 +1037,25 @@ TEST(JSONSchema_frame, cross_2020_12_to_draft4_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, std::nullopt); + "https://json-schema.org/draft/2020-12/schema", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs", "/$defs", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); // Note that `$schema` without an identifier is NOT allowed EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/$defs/schema", "/$defs/schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, ""); + "https://json-schema.org/draft/2020-12/schema", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$defs/schema/$schema", "/$defs/schema/$schema", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", {}, "/$defs/schema"); + "https://json-schema.org/draft/2020-12/schema", "/$defs/schema"); } TEST(JSONSchema_frame, cross_draft7_to_draft4_without_id) { @@ -1091,24 +1079,24 @@ TEST(JSONSchema_frame, cross_draft7_to_draft4_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // Note that `$schema` without an identifier is NOT allowed EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/schema", "/definitions/schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/schema/$schema", "/definitions/schema/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/definitions/schema"); + "http://json-schema.org/draft-07/schema#", "/definitions/schema"); } TEST(JSONSchema_frame, cross_draft7_to_2020_12_without_id) { @@ -1132,14 +1120,14 @@ TEST(JSONSchema_frame, cross_draft7_to_2020_12_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "", "", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, std::nullopt); + "http://json-schema.org/draft-07/schema#", std::nullopt); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/$schema", "/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions", "/definitions", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); // Subschema @@ -1147,11 +1135,11 @@ TEST(JSONSchema_frame, cross_draft7_to_2020_12_without_id) { EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( frame, "#/definitions/schema", "/definitions/schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, ""); + "http://json-schema.org/draft-07/schema#", ""); EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( frame, "#/definitions/schema/$schema", "/definitions/schema/$schema", "http://json-schema.org/draft-07/schema#", - "http://json-schema.org/draft-07/schema#", {}, "/definitions/schema"); + "http://json-schema.org/draft-07/schema#", "/definitions/schema"); } TEST(JSONSchema_frame, anchor_on_absolute_subid) { @@ -1167,26 +1155,26 @@ TEST(JSONSchema_frame, anchor_on_absolute_subid) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); EXPECT_EQ(frame.locations().size(), 12); - EXPECT_FRAME_STATIC_RESOURCE( - frame, "https://www.example.com", "https://www.example.com", "", - "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.com", - "", {""}, std::nullopt); - EXPECT_FRAME_STATIC_RESOURCE( - frame, "https://www.example.org", "https://www.example.com", "/items", - "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "", {"/~?items~/~I~"}, ""); - EXPECT_FRAME_STATIC_ANCHOR( - frame, "https://www.example.org#foo", "https://www.example.com", - "/items/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "/items", {"/~?items~/~I~/~?items~/~I~"}, "/items"); + EXPECT_FRAME_STATIC_RESOURCE(frame, "https://www.example.com", + "https://www.example.com", "", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.com", "", std::nullopt); + EXPECT_FRAME_STATIC_RESOURCE(frame, "https://www.example.org", + "https://www.example.com", "/items", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.org", "", ""); + EXPECT_FRAME_STATIC_ANCHOR(frame, "https://www.example.org#foo", + "https://www.example.com", "/items/items", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.org", "/items", "/items"); // JSON Pointers @@ -1194,48 +1182,48 @@ TEST(JSONSchema_frame, anchor_on_absolute_subid) { "https://www.example.com", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$id", {}, ""); + "https://www.example.com", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/$schema", "https://www.example.com", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$schema", {}, ""); - EXPECT_FRAME_STATIC_SUBSCHEMA( - frame, "https://www.example.com#/items", "https://www.example.com", - "/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "", {"/~?items~/~I~"}, ""); + "https://www.example.com", "/$schema", ""); + EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/items", + "https://www.example.com", "/items", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.org", "", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/items/$id", "https://www.example.com", "/items/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.org", "/$id", {}, "/items"); - EXPECT_FRAME_STATIC_SUBSCHEMA( - frame, "https://www.example.com#/items/items", "https://www.example.com", - "/items/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "/items", {"/~?items~/~I~/~?items~/~I~"}, "/items"); + "https://www.example.org", "/$id", "/items"); + EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/items/items", + "https://www.example.com", "/items/items", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.org", "/items", "/items"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.example.com#/items/items/$anchor", "https://www.example.com", "/items/items/$anchor", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "/items/$anchor", {}, "/items/items"); + "/items/$anchor", "/items/items"); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.org#/$id", "https://www.example.com", "/items/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.org", "/$id", {}, "/items"); - EXPECT_FRAME_STATIC_SUBSCHEMA( - frame, "https://www.example.org#/items", "https://www.example.com", - "/items/items", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.org", - "/items", {"/~?items~/~I~/~?items~/~I~"}, "/items"); + "https://www.example.org", "/$id", "/items"); + EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.org#/items", + "https://www.example.com", "/items/items", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.org", "/items", "/items"); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.org#/items/$anchor", "https://www.example.com", "/items/items/$anchor", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.org", "/items/$anchor", {}, + "https://www.example.org", "/items/$anchor", "/items/items"); // References @@ -1260,7 +1248,7 @@ TEST(JSONSchema_frame, uri_iterators) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1308,7 +1296,7 @@ TEST(JSONSchema_frame, no_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1342,7 +1330,7 @@ TEST(JSONSchema_frame, refs_with_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1387,7 +1375,7 @@ TEST(JSONSchema_frame, refs_with_no_id) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1417,7 +1405,7 @@ TEST(JSONSchema_frame, no_dynamic_ref_on_old_drafts) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1440,7 +1428,7 @@ TEST(JSONSchema_frame, remote_refs) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver); @@ -1557,7 +1545,7 @@ TEST(JSONSchema_frame, no_dialect) { })JSON"); sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; EXPECT_THROW(frame.analyse(document, sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver), sourcemeta::core::SchemaUnknownBaseDialectError); @@ -1588,7 +1576,7 @@ TEST(JSONSchema_frame, mode_references) { "https://www.example.com", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "", {}, std::nullopt); + "https://www.example.com", "", std::nullopt); // JSON Pointers @@ -1596,46 +1584,46 @@ TEST(JSONSchema_frame, mode_references) { "https://www.example.com", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$id", {}, ""); + "https://www.example.com", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/$schema", "https://www.example.com", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$schema", {}, ""); + "https://www.example.com", "/$schema", ""); EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/items", "https://www.example.com", "/items", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items", {}, ""); + "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_ANCHOR(frame, "https://www.example.com#helper", "https://www.example.com", "/items", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items", {}, ""); + "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/items/$anchor", "https://www.example.com", "/items/$anchor", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items/$anchor", {}, + "https://www.example.com", "/items/$anchor", "/items"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.example.com#/items/$ref", "https://www.example.com", "/items/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://www.example.com", - "/items/$ref", {}, "/items"); + "/items/$ref", "/items"); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/$defs", "https://www.example.com", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$defs", {}, ""); - EXPECT_FRAME_STATIC_SUBSCHEMA( - frame, "https://www.example.com#/$defs/helper", "https://www.example.com", - "/$defs/helper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.com", - "/$defs/helper", {}, ""); + "https://www.example.com", "/$defs", ""); + EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/$defs/helper", + "https://www.example.com", "/$defs/helper", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.com", "/$defs/helper", ""); // References @@ -1674,7 +1662,7 @@ TEST(JSONSchema_frame, mode_locations) { "https://www.example.com", "", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "", {}, std::nullopt); + "https://www.example.com", "", std::nullopt); // JSON Pointers @@ -1682,46 +1670,46 @@ TEST(JSONSchema_frame, mode_locations) { "https://www.example.com", "/$id", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$id", {}, ""); + "https://www.example.com", "/$id", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/$schema", "https://www.example.com", "/$schema", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$schema", {}, ""); + "https://www.example.com", "/$schema", ""); EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/items", "https://www.example.com", "/items", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items", {}, ""); + "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_ANCHOR(frame, "https://www.example.com#helper", "https://www.example.com", "/items", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items", {}, ""); + "https://www.example.com", "/items", ""); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/items/$anchor", "https://www.example.com", "/items/$anchor", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/items/$anchor", {}, + "https://www.example.com", "/items/$anchor", "/items"); EXPECT_FRAME_STATIC_POINTER( frame, "https://www.example.com#/items/$ref", "https://www.example.com", "/items/$ref", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", "https://www.example.com", - "/items/$ref", {}, "/items"); + "/items/$ref", "/items"); EXPECT_FRAME_STATIC_POINTER(frame, "https://www.example.com#/$defs", "https://www.example.com", "/$defs", "https://json-schema.org/draft/2020-12/schema", "https://json-schema.org/draft/2020-12/schema", - "https://www.example.com", "/$defs", {}, ""); - EXPECT_FRAME_STATIC_SUBSCHEMA( - frame, "https://www.example.com#/$defs/helper", "https://www.example.com", - "/$defs/helper", "https://json-schema.org/draft/2020-12/schema", - "https://json-schema.org/draft/2020-12/schema", "https://www.example.com", - "/$defs/helper", {}, ""); + "https://www.example.com", "/$defs", ""); + EXPECT_FRAME_STATIC_SUBSCHEMA(frame, "https://www.example.com#/$defs/helper", + "https://www.example.com", "/$defs/helper", + "https://json-schema.org/draft/2020-12/schema", + "https://json-schema.org/draft/2020-12/schema", + "https://www.example.com", "/$defs/helper", ""); // References @@ -1846,241 +1834,14 @@ TEST(JSONSchema_frame, references_to_2) { TEST(JSONSchema_frame, to_json_empty) { sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; + sourcemeta::core::SchemaFrame::Mode::References}; const auto result{frame.to_json()}; const auto expected = sourcemeta::core::parse_json(R"JSON({ "locations": { "static": {}, "dynamic": {} }, - "references": [], - "instances": {} - })JSON"); - - EXPECT_EQ(result, expected); -} - -TEST(JSONSchema_frame, to_json_mode_instances) { - const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ - "$id": "https://www.sourcemeta.com/test", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "foo": { - "$ref": "bar" - }, - "bar": { - "id": "bar", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "string" - } - } - })JSON"); - - sourcemeta::core::SchemaFrame frame{ - sourcemeta::core::SchemaFrame::Mode::Instances}; - frame.analyse(document, sourcemeta::core::schema_walker, - sourcemeta::core::schema_resolver); - - const auto result{frame.to_json()}; - - const auto expected = sourcemeta::core::parse_json(R"JSON({ - "locations": { - "static": { - "https://www.sourcemeta.com/bar": { - "parent": "", - "type": "resource", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar", - "position": null, - "relativePointer": "", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/bar#/$schema": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/$schema", - "position": null, - "relativePointer": "/$schema", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/bar#/id": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/id", - "position": null, - "relativePointer": "/id", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/bar#/type": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/type", - "position": null, - "relativePointer": "/type", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/test": { - "parent": null, - "type": "resource", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "", - "position": null, - "relativePointer": "", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - }, - "https://www.sourcemeta.com/test#/$id": { - "parent": "", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "/$id", - "position": null, - "relativePointer": "/$id", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - }, - "https://www.sourcemeta.com/test#/$schema": { - "parent": "", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "/$schema", - "position": null, - "relativePointer": "/$schema", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - }, - "https://www.sourcemeta.com/test#/properties": { - "parent": "", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "/properties", - "position": null, - "relativePointer": "/properties", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - }, - "https://www.sourcemeta.com/test#/properties/bar": { - "parent": "", - "type": "subschema", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar", - "position": null, - "relativePointer": "", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/test#/properties/bar/$schema": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/$schema", - "position": null, - "relativePointer": "/$schema", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/test#/properties/bar/id": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/id", - "position": null, - "relativePointer": "/id", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/test#/properties/bar/type": { - "parent": "/properties/bar", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/bar", - "pointer": "/properties/bar/type", - "position": null, - "relativePointer": "/type", - "dialect": "http://json-schema.org/draft-04/schema#", - "baseDialect": "http://json-schema.org/draft-04/schema#" - }, - "https://www.sourcemeta.com/test#/properties/foo": { - "parent": "", - "type": "subschema", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "/properties/foo", - "position": null, - "relativePointer": "/properties/foo", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - }, - "https://www.sourcemeta.com/test#/properties/foo/$ref": { - "parent": "/properties/foo", - "type": "pointer", - "root": "https://www.sourcemeta.com/test", - "base": "https://www.sourcemeta.com/test", - "pointer": "/properties/foo/$ref", - "position": null, - "relativePointer": "/properties/foo/$ref", - "dialect": "https://json-schema.org/draft/2020-12/schema", - "baseDialect": "https://json-schema.org/draft/2020-12/schema" - } - }, - "dynamic": {} - }, - "references": [ - { - "type": "static", - "origin": "/$schema", - "position": null, - "destination": "https://json-schema.org/draft/2020-12/schema", - "base": "https://json-schema.org/draft/2020-12/schema", - "fragment": null - }, - { - "type": "static", - "origin": "/properties/bar/$schema", - "position": null, - "destination": "http://json-schema.org/draft-04/schema", - "base": "http://json-schema.org/draft-04/schema", - "fragment": null - }, - { - "type": "static", - "origin": "/properties/foo/$ref", - "position": null, - "destination": "https://www.sourcemeta.com/bar", - "base": "https://www.sourcemeta.com/bar", - "fragment": null - } - ], - "instances": { - "": [ - "" - ], - "/properties/bar": [ - "/bar", - "/foo" - ], - "/properties/foo": [ - "/foo" - ] - } + "references": [] })JSON"); EXPECT_EQ(result, expected); @@ -2294,8 +2055,7 @@ TEST(JSONSchema_frame, to_json_mode_references) { "base": "https://www.sourcemeta.com/bar", "fragment": null } - ], - "instances": {} + ] })JSON"); EXPECT_EQ(result, expected); @@ -2484,8 +2244,7 @@ TEST(JSONSchema_frame, to_json_mode_locations) { }, "dynamic": {} }, - "references": [], - "instances": {} + "references": [] })JSON"); EXPECT_EQ(result, expected); @@ -2702,8 +2461,7 @@ TEST(JSONSchema_frame, to_json_mode_references_with_tracking) { "base": "https://www.sourcemeta.com/bar", "fragment": null } - ], - "instances": {} + ] })JSON"); EXPECT_EQ(result, expected); @@ -2920,8 +2678,7 @@ TEST(JSONSchema_frame, to_json_mode_references_with_tracking_empty) { "base": "https://www.sourcemeta.com/bar", "fragment": null } - ], - "instances": {} + ] })JSON"); EXPECT_EQ(result, expected); diff --git a/test/jsonschema/jsonschema_test_utils.h b/test/jsonschema/jsonschema_test_utils.h index 8262313fa..9aac9ac3c 100644 --- a/test/jsonschema/jsonschema_test_utils.h +++ b/test/jsonschema/jsonschema_test_utils.h @@ -46,26 +46,13 @@ EXPECT_EQ(stream.str(), (expected)); \ } -#define EXPECT_POINTER_TEMPLATES(input_list, expected) \ - { \ - const std::vector expected_list(expected); \ - EXPECT_EQ(input_list.size(), expected_list.size()); \ - for (std::size_t index = 0; index < (input_list).size(); index++) { \ - std::ostringstream stream; \ - sourcemeta::core::stringify((input_list)[index], stream); \ - EXPECT_EQ(stream.str(), expected_list[index]); \ - } \ - } - -#define POINTER_TEMPLATES(...) std::vector({__VA_ARGS__}) - #define TO_POINTER(pointer_string) \ sourcemeta::core::to_pointer((pointer_string)) -#define EXPECT_FRAME( \ - frame, expected_type, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, expected_parent) \ +#define EXPECT_FRAME(frame, expected_type, reference, root_id, \ + expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent) \ EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).root, \ std::optional(root_id)); \ @@ -81,9 +68,6 @@ EXPECT_EQ( \ (frame).locations().at({(expected_type), (reference)}).relative_pointer, \ TO_POINTER(expected_relative_pointer)); \ - EXPECT_POINTER_TEMPLATES((frame).instance_locations((frame).locations().at( \ - {(expected_type), (reference)})), \ - expected_instance_locations); \ EXPECT_OPTIONAL_POINTER( \ (frame).locations().at({(expected_type), (reference)}).parent, \ expected_parent); @@ -91,21 +75,19 @@ #define EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME(frame, sourcemeta::core::SchemaReferenceType::Static, \ reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) + expected_relative_pointer, expected_parent) #define EXPECT_FRAME_STATIC_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -116,11 +98,10 @@ #define EXPECT_FRAME_STATIC_POINTER( \ frame, reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -131,11 +112,10 @@ #define EXPECT_FRAME_STATIC_SUBSCHEMA( \ frame, reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -143,14 +123,13 @@ .type, \ sourcemeta::core::SchemaFrame::LocationType::Subschema); -#define EXPECT_FRAME_STATIC_ANCHOR( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ +#define EXPECT_FRAME_STATIC_ANCHOR(frame, reference, root_id, \ + expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent) \ EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -161,11 +140,10 @@ #define EXPECT_FRAME_DYNAMIC_ANCHOR( \ frame, reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME_DYNAMIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) \ + expected_relative_pointer, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -176,16 +154,15 @@ #define EXPECT_FRAME_DYNAMIC(frame, reference, root_id, expected_pointer, \ expected_dialect, expected_base_dialect, \ expected_base, expected_relative_pointer, \ - expected_instance_locations, expected_parent) \ + expected_parent) \ EXPECT_FRAME(frame, sourcemeta::core::SchemaReferenceType::Dynamic, \ reference, root_id, expected_pointer, expected_dialect, \ expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_instance_locations, \ - expected_parent) + expected_relative_pointer, expected_parent) -#define __EXPECT_ANONYMOUS_FRAME( \ - frame, expected_type, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ +#define __EXPECT_ANONYMOUS_FRAME(frame, expected_type, reference, \ + expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ EXPECT_FALSE((frame) \ .locations() \ @@ -198,28 +175,25 @@ EXPECT_EQ( \ (frame).locations().at({(expected_type), (reference)}).base_dialect, \ (expected_base_dialect)); \ - EXPECT_POINTER_TEMPLATES((frame).instance_locations((frame).locations().at( \ - {(expected_type), (reference)})), \ - expected_instance_locations); \ EXPECT_OPTIONAL_POINTER( \ (frame).locations().at({(expected_type), (reference)}).parent, \ expected_parent); -#define EXPECT_ANONYMOUS_FRAME_STATIC( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) +#define EXPECT_ANONYMOUS_FRAME_STATIC(frame, reference, expected_pointer, \ + expected_dialect, expected_base_dialect, \ + expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Static, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) #define EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( \ frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) \ + expected_base_dialect, expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Static, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -229,11 +203,11 @@ #define EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( \ frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) \ + expected_base_dialect, expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Static, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -243,11 +217,11 @@ #define EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( \ frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) \ + expected_base_dialect, expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Static, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -257,11 +231,11 @@ #define EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( \ frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) \ + expected_base_dialect, expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Static, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -271,11 +245,11 @@ #define EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( \ frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_instance_locations, expected_parent) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::core::SchemaReferenceType::Dynamic, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_instance_locations, expected_parent) \ + expected_base_dialect, expected_parent) \ + __EXPECT_ANONYMOUS_FRAME(frame, \ + sourcemeta::core::SchemaReferenceType::Dynamic, \ + reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent) \ EXPECT_EQ( \ (frame) \ .locations() \ @@ -322,10 +296,9 @@ expected_pointer, expected_uri, expected_base, \ expected_fragment, expected_original) -#define __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_dialect, expected_base_dialect, expected_instance_location, \ - expected_relative_instance_location) \ +#define __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, expected_dialect, \ + expected_base_dialect) \ EXPECT_EQ(sourcemeta::core::to_string(entries.at(index).pointer), \ expected_schema_location); \ EXPECT_OPTIONAL_POINTER(entries.at(index).parent, expected_parent_location); \ @@ -333,190 +306,150 @@ EXPECT_TRUE(entries.at(index).base_dialect.has_value()); \ EXPECT_EQ(entries.at(index).dialect.value(), expected_dialect); \ EXPECT_EQ(entries.at(index).base_dialect.value(), expected_base_dialect); \ - EXPECT_FALSE(entries.at(index).vocabularies.empty()); \ - EXPECT_POINTER_TEMPLATE(entries.at(index).instance_location, \ - expected_instance_location); \ - EXPECT_POINTER_TEMPLATE(entries.at(index).relative_instance_location, \ - expected_relative_instance_location); - -#define EXPECT_WALKER_ENTRY_2020_12( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "https://json-schema.org/draft/2020-12/schema", \ - "https://json-schema.org/draft/2020-12/schema", \ - expected_instance_location, expected_relative_instance_location); \ + EXPECT_FALSE(entries.at(index).vocabularies.empty()); + +#define EXPECT_WALKER_ENTRY_2020_12(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2020-12/schema", \ + "https://json-schema.org/draft/2020-12/schema"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_2020_12_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "https://json-schema.org/draft/2020-12/schema", \ - "https://json-schema.org/draft/2020-12/schema", \ - expected_instance_location, expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2020-12/schema", \ + "https://json-schema.org/draft/2020-12/schema"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_2019_09( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "https://json-schema.org/draft/2019-09/schema", \ - "https://json-schema.org/draft/2019-09/schema", \ - expected_instance_location, expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_2019_09(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2019-09/schema", \ + "https://json-schema.org/draft/2019-09/schema"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_2019_09_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "https://json-schema.org/draft/2019-09/schema", \ - "https://json-schema.org/draft/2019-09/schema", \ - expected_instance_location, expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2019-09/schema", \ + "https://json-schema.org/draft/2019-09/schema"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT7( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-07/schema#", \ - "http://json-schema.org/draft-07/schema#", expected_instance_location, \ - expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT7(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-07/schema#", \ + "http://json-schema.org/draft-07/schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-07/schema#", \ - "http://json-schema.org/draft-07/schema#", expected_instance_location, \ - expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-07/schema#", \ + "http://json-schema.org/draft-07/schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT6( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-06/schema#", \ - "http://json-schema.org/draft-06/schema#", expected_instance_location, \ - expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT6(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-06/schema#", \ + "http://json-schema.org/draft-06/schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-06/schema#", \ - "http://json-schema.org/draft-06/schema#", expected_instance_location, \ - expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-06/schema#", \ + "http://json-schema.org/draft-06/schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT4( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-04/schema#", \ - "http://json-schema.org/draft-04/schema#", expected_instance_location, \ - expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT4(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-04/schema#", \ + "http://json-schema.org/draft-04/schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-04/schema#", \ - "http://json-schema.org/draft-04/schema#", expected_instance_location, \ - expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-04/schema#", \ + "http://json-schema.org/draft-04/schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT3( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-03/schema#", \ - "http://json-schema.org/draft-03/schema#", expected_instance_location, \ - expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT3(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-03/schema#", \ + "http://json-schema.org/draft-03/schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT3_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-03/schema#", \ - "http://json-schema.org/draft-03/schema#", expected_instance_location, \ - expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-03/schema#", \ + "http://json-schema.org/draft-03/schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT2( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-02/schema#", \ - "http://json-schema.org/draft-02/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT2(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-02/schema#", \ + "http://json-schema.org/draft-02/hyper-schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT2_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-02/schema#", \ - "http://json-schema.org/draft-02/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-02/schema#", \ + "http://json-schema.org/draft-02/hyper-schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT1( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-01/schema#", \ - "http://json-schema.org/draft-01/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT1(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-01/schema#", \ + "http://json-schema.org/draft-01/hyper-schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT1_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-01/schema#", \ - "http://json-schema.org/draft-01/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-01/schema#", \ + "http://json-schema.org/draft-01/hyper-schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_WALKER_ENTRY_DRAFT0( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-00/schema#", \ - "http://json-schema.org/draft-00/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ +#define EXPECT_WALKER_ENTRY_DRAFT0(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-00/schema#", \ + "http://json-schema.org/draft-00/hyper-schema#"); \ EXPECT_FALSE(entries.at(index).orphan); #define EXPECT_WALKER_ENTRY_DRAFT0_ORPHAN( \ - entries, index, expected_schema_location, expected_parent_location, \ - expected_instance_location, expected_relative_instance_location) \ - __EXPECT_WALKER_ENTRY( \ - entries, index, expected_schema_location, expected_parent_location, \ - "http://json-schema.org/draft-00/schema#", \ - "http://json-schema.org/draft-00/hyper-schema#", \ - expected_instance_location, expected_relative_instance_location); \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-00/schema#", \ + "http://json-schema.org/draft-00/hyper-schema#"); \ EXPECT_TRUE(entries.at(index).orphan); #define EXPECT_REFERENCE_TO(result, index, type, origin) \ diff --git a/test/jsonschema/jsonschema_walker_2019_09_test.cc b/test/jsonschema/jsonschema_walker_2019_09_test.cc index 809324cbb..90eca3d25 100644 --- a/test/jsonschema/jsonschema_walker_2019_09_test.cc +++ b/test/jsonschema/jsonschema_walker_2019_09_test.cc @@ -1772,69 +1772,47 @@ TEST(JSONSchema_walker_2019_09, instance_locations) { EXPECT_EQ(entries.size(), 28); - EXPECT_WALKER_ENTRY_2019_09(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 0, "", std::nullopt); // Applicator vocabulary (any) - EXPECT_WALKER_ENTRY_2019_09(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_2019_09(entries, 2, "/allOf/1", "", "", ""); - EXPECT_WALKER_ENTRY_2019_09(entries, 3, "/anyOf/0", "", "/~?anyOf~/~?0~", - "/~?anyOf~/~?0~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 4, "/oneOf/0", "", "/~?oneOf~/~?0~", - "/~?oneOf~/~?0~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 5, "/if", "", "/~?if~", "/~?if~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 6, "/then", "", "/~?then~", "/~?then~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 7, "/else", "", "/~?else~", "/~?else~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 8, "/not", "", "/~!~", "/~!~"); + EXPECT_WALKER_ENTRY_2019_09(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 2, "/allOf/1", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 3, "/anyOf/0", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 4, "/oneOf/0", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 5, "/if", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 6, "/then", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 7, "/else", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 8, "/not", ""); // Applicator vocabulary (object) - EXPECT_WALKER_ENTRY_2019_09(entries, 9, "/properties/foo", "", "/foo", - "/foo"); - EXPECT_WALKER_ENTRY_2019_09(entries, 10, "/properties/bar", "", "/bar", - "/bar"); - EXPECT_WALKER_ENTRY_2019_09(entries, 11, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 12, "/patternProperties/^f", "", - "/~R^f~", "/~R^f~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 13, "/patternProperties/x$", "", - "/~Rx$~", "/~Rx$~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 14, "/dependentSchemas/foo", "", - "/~?dependentSchemas~/~?foo~", - "/~?dependentSchemas~/~?foo~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 15, "/dependentSchemas/bar", "", - "/~?dependentSchemas~/~?bar~", - "/~?dependentSchemas~/~?bar~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 16, "/propertyNames", "", "/~K~", - "/~K~"); + EXPECT_WALKER_ENTRY_2019_09(entries, 9, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 10, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 11, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 12, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 13, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 14, "/dependentSchemas/foo", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 15, "/dependentSchemas/bar", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 16, "/propertyNames", ""); // Applicator vocabulary (array) - EXPECT_WALKER_ENTRY_2019_09(entries, 17, "/contains", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 18, "/additionalItems", "", - "/~?additionalItems~/~I~", - "/~?additionalItems~/~I~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 19, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 20, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_2019_09(entries, 21, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_2019_09(entries, 17, "/contains", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 18, "/additionalItems", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 19, "/items", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 20, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_2019_09(entries, 21, "/items/items/1", "/items"); // Unevaluated applicators - EXPECT_WALKER_ENTRY_2019_09(entries, 22, "/unevaluatedProperties", "", - "/~?unevaluatedProperties~/~P~", - "/~?unevaluatedProperties~/~P~"); - EXPECT_WALKER_ENTRY_2019_09(entries, 23, "/unevaluatedItems", "", - "/~?unevaluatedItems~/~I~", - "/~?unevaluatedItems~/~I~"); + EXPECT_WALKER_ENTRY_2019_09(entries, 22, "/unevaluatedProperties", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 23, "/unevaluatedItems", ""); // Content vocabulary - EXPECT_WALKER_ENTRY_2019_09(entries, 24, "/contentSchema", "", "", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 24, "/contentSchema", ""); // Core vocabulary - EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 25, "/$defs/foo", "", "", ""); + EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 25, "/$defs/foo", ""); EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 26, "/$defs/foo/properties/bar", - "/$defs/foo", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 27, "/definitions/foo", "", "", - ""); + "/$defs/foo"); + EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 27, "/definitions/foo", ""); } TEST(JSONSchema_walker_2019_09, definitions_subschemas) { @@ -1862,12 +1840,11 @@ TEST(JSONSchema_walker_2019_09, definitions_subschemas) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_2019_09(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 1, "/$defs/foo", "", "", ""); + EXPECT_WALKER_ENTRY_2019_09(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 1, "/$defs/foo", ""); EXPECT_WALKER_ENTRY_2019_09_ORPHAN(entries, 2, "/$defs/foo/properties/bar", - "/$defs/foo", "/bar", "/bar"); + "/$defs/foo"); EXPECT_WALKER_ENTRY_2019_09_ORPHAN( entries, 3, "/$defs/foo/properties/bar/additionalProperties", - "/$defs/foo/properties/bar", "/bar/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/$defs/foo/properties/bar"); } diff --git a/test/jsonschema/jsonschema_walker_2020_12_test.cc b/test/jsonschema/jsonschema_walker_2020_12_test.cc index a58df4fe1..a63aaef9a 100644 --- a/test/jsonschema/jsonschema_walker_2020_12_test.cc +++ b/test/jsonschema/jsonschema_walker_2020_12_test.cc @@ -1852,65 +1852,46 @@ TEST(JSONSchema_walker_2020_12, instance_locations) { EXPECT_EQ(entries.size(), 27); - EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt); // Applicator vocabulary (any) - EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_2020_12(entries, 2, "/allOf/1", "", "", ""); - EXPECT_WALKER_ENTRY_2020_12(entries, 3, "/anyOf/0", "", "/~?anyOf~/~?0~", - "/~?anyOf~/~?0~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 4, "/oneOf/0", "", "/~?oneOf~/~?0~", - "/~?oneOf~/~?0~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 5, "/if", "", "/~?if~", "/~?if~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 6, "/then", "", "/~?then~", "/~?then~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 7, "/else", "", "/~?else~", "/~?else~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 8, "/not", "", "/~!~", "/~!~"); + EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 2, "/allOf/1", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 3, "/anyOf/0", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 4, "/oneOf/0", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 5, "/if", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 6, "/then", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 7, "/else", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 8, "/not", ""); // Applicator vocabulary (object) - EXPECT_WALKER_ENTRY_2020_12(entries, 9, "/properties/foo", "", "/foo", - "/foo"); - EXPECT_WALKER_ENTRY_2020_12(entries, 10, "/properties/bar", "", "/bar", - "/bar"); - EXPECT_WALKER_ENTRY_2020_12(entries, 11, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 12, "/patternProperties/^f", "", - "/~R^f~", "/~R^f~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 13, "/patternProperties/x$", "", - "/~Rx$~", "/~Rx$~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 14, "/dependentSchemas/foo", "", - "/~?dependentSchemas~/~?foo~", - "/~?dependentSchemas~/~?foo~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 15, "/dependentSchemas/bar", "", - "/~?dependentSchemas~/~?bar~", - "/~?dependentSchemas~/~?bar~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 16, "/propertyNames", "", "/~K~", - "/~K~"); + EXPECT_WALKER_ENTRY_2020_12(entries, 9, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 10, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 11, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 12, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 13, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 14, "/dependentSchemas/foo", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 15, "/dependentSchemas/bar", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 16, "/propertyNames", ""); // Applicator vocabulary (array) - EXPECT_WALKER_ENTRY_2020_12(entries, 17, "/contains", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 18, "/items", "", "/~?items~/~I~", - "/~?items~/~I~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 19, "/prefixItems/0", "", "/0", "/0"); - EXPECT_WALKER_ENTRY_2020_12(entries, 20, "/prefixItems/1", "", "/1", "/1"); + EXPECT_WALKER_ENTRY_2020_12(entries, 17, "/contains", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 18, "/items", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 19, "/prefixItems/0", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 20, "/prefixItems/1", ""); // Unevaluated vocabulary - EXPECT_WALKER_ENTRY_2020_12(entries, 21, "/unevaluatedProperties", "", - "/~?unevaluatedProperties~/~P~", - "/~?unevaluatedProperties~/~P~"); - EXPECT_WALKER_ENTRY_2020_12(entries, 22, "/unevaluatedItems", "", - "/~?unevaluatedItems~/~I~", - "/~?unevaluatedItems~/~I~"); + EXPECT_WALKER_ENTRY_2020_12(entries, 21, "/unevaluatedProperties", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 22, "/unevaluatedItems", ""); // Content vocabulary - EXPECT_WALKER_ENTRY_2020_12(entries, 23, "/contentSchema", "", "", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 23, "/contentSchema", ""); // Core vocabulary - EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 24, "/$defs/foo", "", "", ""); + EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 24, "/$defs/foo", ""); EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 25, "/$defs/foo/properties/bar", - "/$defs/foo", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 26, "/definitions/foo", "", "", - ""); + "/$defs/foo"); + EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 26, "/definitions/foo", ""); } TEST(JSONSchema_walker_2020_12, instance_locations_nested) { @@ -1936,17 +1917,14 @@ TEST(JSONSchema_walker_2020_12, instance_locations_nested) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_2020_12( - entries, 2, "/additionalProperties/properties/foo", - "/additionalProperties", "/~?additionalProperties~/~P~/foo", "/foo"); + EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 2, + "/additionalProperties/properties/foo", + "/additionalProperties"); EXPECT_WALKER_ENTRY_2020_12(entries, 3, "/additionalProperties/properties/foo/allOf/0", - "/additionalProperties/properties/foo", - "/~?additionalProperties~/~P~/foo", ""); + "/additionalProperties/properties/foo"); } TEST(JSONSchema_walker_2020_12, instance_locations_defs_with_ref) { @@ -1970,9 +1948,9 @@ TEST(JSONSchema_walker_2020_12, instance_locations_defs_with_ref) { EXPECT_EQ(entries.size(), 3); - EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 2, "/$defs/foo", "", "", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_2020_12(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 2, "/$defs/foo", ""); } TEST(JSONSchema_walker_2020_12, definitions_subschemas) { @@ -2000,12 +1978,11 @@ TEST(JSONSchema_walker_2020_12, definitions_subschemas) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 1, "/$defs/foo", "", "", ""); + EXPECT_WALKER_ENTRY_2020_12(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 1, "/$defs/foo", ""); EXPECT_WALKER_ENTRY_2020_12_ORPHAN(entries, 2, "/$defs/foo/properties/bar", - "/$defs/foo", "/bar", "/bar"); + "/$defs/foo"); EXPECT_WALKER_ENTRY_2020_12_ORPHAN( entries, 3, "/$defs/foo/properties/bar/additionalProperties", - "/$defs/foo/properties/bar", "/bar/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/$defs/foo/properties/bar"); } diff --git a/test/jsonschema/jsonschema_walker_draft0_test.cc b/test/jsonschema/jsonschema_walker_draft0_test.cc index e3802315e..d2ed78cc8 100644 --- a/test/jsonschema/jsonschema_walker_draft0_test.cc +++ b/test/jsonschema/jsonschema_walker_draft0_test.cc @@ -960,30 +960,23 @@ TEST(JSONSchema_walker_draft0, instance_locations) { EXPECT_EQ(entries.size(), 12); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 0, "", std::nullopt); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT0(entries, 1, "/properties/foo", "", "/foo", "/foo"); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 1, "/properties/foo", ""); EXPECT_WALKER_ENTRY_DRAFT0(entries, 2, "/properties/foo/requires", - "/properties/foo", "", ""); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 3, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 4, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/properties/foo"); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 3, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 4, "/additionalProperties", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT0(entries, 5, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 6, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 7, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 5, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 6, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 7, "/items/items/1", "/items"); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT0(entries, 8, "/type/1", "", "/~?type~/~?1~", - "/~?type~/~?1~"); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 9, "/type/2", "", "/~?type~/~?2~", - "/~?type~/~?2~"); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 10, "/extends", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT0(entries, 11, "/extends/extends/0", "/extends", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 8, "/type/1", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 9, "/type/2", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 10, "/extends", ""); + EXPECT_WALKER_ENTRY_DRAFT0(entries, 11, "/extends/extends/0", "/extends"); } diff --git a/test/jsonschema/jsonschema_walker_draft1_test.cc b/test/jsonschema/jsonschema_walker_draft1_test.cc index b219d0f24..981bfedbe 100644 --- a/test/jsonschema/jsonschema_walker_draft1_test.cc +++ b/test/jsonschema/jsonschema_walker_draft1_test.cc @@ -960,30 +960,23 @@ TEST(JSONSchema_walker_draft1, instance_locations) { EXPECT_EQ(entries.size(), 12); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 0, "", std::nullopt); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT1(entries, 1, "/properties/foo", "", "/foo", "/foo"); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 1, "/properties/foo", ""); EXPECT_WALKER_ENTRY_DRAFT1(entries, 2, "/properties/foo/requires", - "/properties/foo", "", ""); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 3, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 4, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/properties/foo"); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 3, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 4, "/additionalProperties", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT1(entries, 5, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 6, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 7, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 5, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 6, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 7, "/items/items/1", "/items"); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT1(entries, 8, "/type/1", "", "/~?type~/~?1~", - "/~?type~/~?1~"); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 9, "/type/2", "", "/~?type~/~?2~", - "/~?type~/~?2~"); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 10, "/extends", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT1(entries, 11, "/extends/extends/0", "/extends", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 8, "/type/1", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 9, "/type/2", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 10, "/extends", ""); + EXPECT_WALKER_ENTRY_DRAFT1(entries, 11, "/extends/extends/0", "/extends"); } diff --git a/test/jsonschema/jsonschema_walker_draft2_test.cc b/test/jsonschema/jsonschema_walker_draft2_test.cc index 7be912520..c6b5ce131 100644 --- a/test/jsonschema/jsonschema_walker_draft2_test.cc +++ b/test/jsonschema/jsonschema_walker_draft2_test.cc @@ -964,30 +964,23 @@ TEST(JSONSchema_walker_draft2, instance_locations) { EXPECT_EQ(entries.size(), 12); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 0, "", std::nullopt); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT2(entries, 1, "/properties/foo", "", "/foo", "/foo"); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 1, "/properties/foo", ""); EXPECT_WALKER_ENTRY_DRAFT2(entries, 2, "/properties/foo/requires", - "/properties/foo", "", ""); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 3, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 4, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/properties/foo"); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 3, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 4, "/additionalProperties", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT2(entries, 5, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 6, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 7, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 5, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 6, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 7, "/items/items/1", "/items"); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT2(entries, 8, "/type/1", "", "/~?type~/~?1~", - "/~?type~/~?1~"); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 9, "/type/2", "", "/~?type~/~?2~", - "/~?type~/~?2~"); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 10, "/extends", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT2(entries, 11, "/extends/extends/0", "/extends", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 8, "/type/1", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 9, "/type/2", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 10, "/extends", ""); + EXPECT_WALKER_ENTRY_DRAFT2(entries, 11, "/extends/extends/0", "/extends"); } diff --git a/test/jsonschema/jsonschema_walker_draft3_test.cc b/test/jsonschema/jsonschema_walker_draft3_test.cc index 30a215c07..db399714d 100644 --- a/test/jsonschema/jsonschema_walker_draft3_test.cc +++ b/test/jsonschema/jsonschema_walker_draft3_test.cc @@ -736,42 +736,27 @@ TEST(JSONSchema_walker_draft3, instance_locations) { EXPECT_EQ(entries.size(), 17); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 0, "", std::nullopt); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT3(entries, 1, "/properties/foo", "", "/foo", "/foo"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 2, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 3, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 4, "/patternProperties/^f", "", "/~R^f~", - "/~R^f~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 5, "/patternProperties/x$", "", "/~Rx$~", - "/~Rx$~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 6, "/dependencies/baz", "", - "/~?dependencies~/~?baz~", - "/~?dependencies~/~?baz~"); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 1, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 2, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 3, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 4, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 5, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 6, "/dependencies/baz", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT3(entries, 7, "/additionalItems", "", - "/~?additionalItems~/~I~", - "/~?additionalItems~/~I~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 8, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 9, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 10, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 7, "/additionalItems", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 8, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 9, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 10, "/items/items/1", "/items"); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT3(entries, 11, "/type/1", "", "/~?type~/~?1~", - "/~?type~/~?1~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 12, "/type/2", "", "/~?type~/~?2~", - "/~?type~/~?2~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 13, "/disallow/1", "", - "/~?disallow~/~?1~/~!~", "/~?disallow~/~?1~/~!~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 14, "/disallow/2", "", - "/~?disallow~/~?2~/~!~", "/~?disallow~/~?2~/~!~"); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 15, "/extends", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT3(entries, 16, "/extends/extends/0", "/extends", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 11, "/type/1", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 12, "/type/2", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 13, "/disallow/1", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 14, "/disallow/2", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 15, "/extends", ""); + EXPECT_WALKER_ENTRY_DRAFT3(entries, 16, "/extends/extends/0", "/extends"); } diff --git a/test/jsonschema/jsonschema_walker_draft4_test.cc b/test/jsonschema/jsonschema_walker_draft4_test.cc index d72ae5206..1935fce17 100644 --- a/test/jsonschema/jsonschema_walker_draft4_test.cc +++ b/test/jsonschema/jsonschema_walker_draft4_test.cc @@ -769,44 +769,31 @@ TEST(JSONSchema_walker_draft4, instance_locations) { EXPECT_EQ(entries.size(), 17); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 0, "", std::nullopt); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT4(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 2, "/allOf/1", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 3, "/anyOf/0", "", "/~?anyOf~/~?0~", - "/~?anyOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 4, "/oneOf/0", "", "/~?oneOf~/~?0~", - "/~?oneOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 5, "/not", "", "/~!~", "/~!~"); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 2, "/allOf/1", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 3, "/anyOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 4, "/oneOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 5, "/not", ""); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT4(entries, 6, "/properties/foo", "", "/foo", "/foo"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 7, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 8, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 9, "/patternProperties/^f", "", "/~R^f~", - "/~R^f~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 10, "/patternProperties/x$", "", "/~Rx$~", - "/~Rx$~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 11, "/dependencies/baz", "", - "/~?dependencies~/~?baz~", - "/~?dependencies~/~?baz~"); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 6, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 7, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 8, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 9, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 10, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 11, "/dependencies/baz", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT4(entries, 12, "/additionalItems", "", - "/~?additionalItems~/~I~", - "/~?additionalItems~/~I~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 13, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 14, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 15, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 12, "/additionalItems", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 13, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 14, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 15, "/items/items/1", "/items"); // Core - EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN(entries, 16, "/definitions/foo", "", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN(entries, 16, "/definitions/foo", ""); } TEST(JSONSchema_walker_draft4, definitions_subschemas) { @@ -834,13 +821,11 @@ TEST(JSONSchema_walker_draft4, definitions_subschemas) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_DRAFT4(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN(entries, 1, "/definitions/foo", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN(entries, 2, - "/definitions/foo/properties/bar", - "/definitions/foo", "/bar", "/bar"); + EXPECT_WALKER_ENTRY_DRAFT4(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN(entries, 1, "/definitions/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN( + entries, 2, "/definitions/foo/properties/bar", "/definitions/foo"); EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/definitions/foo/properties/bar"); } diff --git a/test/jsonschema/jsonschema_walker_draft6_test.cc b/test/jsonschema/jsonschema_walker_draft6_test.cc index 49f416ce6..c78189bba 100644 --- a/test/jsonschema/jsonschema_walker_draft6_test.cc +++ b/test/jsonschema/jsonschema_walker_draft6_test.cc @@ -822,46 +822,33 @@ TEST(JSONSchema_walker_draft6, instance_locations) { EXPECT_EQ(entries.size(), 19); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 0, "", std::nullopt); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT6(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 2, "/allOf/1", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 3, "/anyOf/0", "", "/~?anyOf~/~?0~", - "/~?anyOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 4, "/oneOf/0", "", "/~?oneOf~/~?0~", - "/~?oneOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 5, "/not", "", "/~!~", "/~!~"); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 2, "/allOf/1", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 3, "/anyOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 4, "/oneOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 5, "/not", ""); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT6(entries, 6, "/properties/foo", "", "/foo", "/foo"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 7, "/properties/bar", "", "/bar", "/bar"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 8, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 9, "/patternProperties/^f", "", "/~R^f~", - "/~R^f~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 10, "/patternProperties/x$", "", "/~Rx$~", - "/~Rx$~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 11, "/dependencies/baz", "", - "/~?dependencies~/~?baz~", - "/~?dependencies~/~?baz~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 12, "/propertyNames", "", "/~K~", "/~K~"); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 6, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 7, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 8, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 9, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 10, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 11, "/dependencies/baz", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 12, "/propertyNames", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT6(entries, 13, "/contains", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 14, "/additionalItems", "", - "/~?additionalItems~/~I~", - "/~?additionalItems~/~I~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 15, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 16, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 17, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 13, "/contains", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 14, "/additionalItems", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 15, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 16, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 17, "/items/items/1", "/items"); // Core - EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN(entries, 18, "/definitions/foo", "", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN(entries, 18, "/definitions/foo", ""); } TEST(JSONSchema_walker_draft6, definitions_subschemas) { @@ -889,13 +876,11 @@ TEST(JSONSchema_walker_draft6, definitions_subschemas) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_DRAFT6(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN(entries, 1, "/definitions/foo", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN(entries, 2, - "/definitions/foo/properties/bar", - "/definitions/foo", "/bar", "/bar"); + EXPECT_WALKER_ENTRY_DRAFT6(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN(entries, 1, "/definitions/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN( + entries, 2, "/definitions/foo/properties/bar", "/definitions/foo"); EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/definitions/foo/properties/bar"); } diff --git a/test/jsonschema/jsonschema_walker_draft7_test.cc b/test/jsonschema/jsonschema_walker_draft7_test.cc index ec1aea295..2aa2b062d 100644 --- a/test/jsonschema/jsonschema_walker_draft7_test.cc +++ b/test/jsonschema/jsonschema_walker_draft7_test.cc @@ -1032,50 +1032,36 @@ TEST(JSONSchema_walker_draft7, instance_locations) { EXPECT_EQ(entries.size(), 22); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 0, "", std::nullopt, "", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 0, "", std::nullopt); // Applicators (any) - EXPECT_WALKER_ENTRY_DRAFT7(entries, 1, "/allOf/0", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 2, "/allOf/1", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 3, "/anyOf/0", "", "/~?anyOf~/~?0~", - "/~?anyOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 4, "/oneOf/0", "", "/~?oneOf~/~?0~", - "/~?oneOf~/~?0~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 5, "/if", "", "/~?if~", "/~?if~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 6, "/then", "", "/~?then~", "/~?then~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 7, "/else", "", "/~?else~", "/~?else~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 8, "/not", "", "/~!~", "/~!~"); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 1, "/allOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 2, "/allOf/1", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 3, "/anyOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 4, "/oneOf/0", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 5, "/if", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 6, "/then", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 7, "/else", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 8, "/not", ""); // Applicators (object) - EXPECT_WALKER_ENTRY_DRAFT7(entries, 9, "/properties/foo", "", "/foo", "/foo"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 10, "/properties/bar", "", "/bar", - "/bar"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 11, "/additionalProperties", "", - "/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 12, "/patternProperties/^f", "", "/~R^f~", - "/~R^f~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 13, "/patternProperties/x$", "", "/~Rx$~", - "/~Rx$~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 14, "/dependencies/baz", "", - "/~?dependencies~/~?baz~", - "/~?dependencies~/~?baz~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 15, "/propertyNames", "", "/~K~", "/~K~"); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 9, "/properties/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 10, "/properties/bar", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 11, "/additionalProperties", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 12, "/patternProperties/^f", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 13, "/patternProperties/x$", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 14, "/dependencies/baz", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 15, "/propertyNames", ""); // Applicators (array) - EXPECT_WALKER_ENTRY_DRAFT7(entries, 16, "/contains", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 17, "/additionalItems", "", - "/~?additionalItems~/~I~", - "/~?additionalItems~/~I~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 18, "/items", "", "/~I~", "/~I~"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 19, "/items/items/0", "/items", "/~I~/0", - "/0"); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 20, "/items/items/1", "/items", "/~I~/1", - "/1"); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 16, "/contains", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 17, "/additionalItems", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 18, "/items", ""); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 19, "/items/items/0", "/items"); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 20, "/items/items/1", "/items"); // Core - EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN(entries, 21, "/definitions/foo", "", "", - ""); + EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN(entries, 21, "/definitions/foo", ""); } TEST(JSONSchema_walker_draft7, definitions_subschemas) { @@ -1103,13 +1089,11 @@ TEST(JSONSchema_walker_draft7, definitions_subschemas) { EXPECT_EQ(entries.size(), 4); - EXPECT_WALKER_ENTRY_DRAFT7(entries, 0, "", std::nullopt, "", ""); - EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN(entries, 1, "/definitions/foo", "", "", ""); - EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN(entries, 2, - "/definitions/foo/properties/bar", - "/definitions/foo", "/bar", "/bar"); + EXPECT_WALKER_ENTRY_DRAFT7(entries, 0, "", std::nullopt); + EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN(entries, 1, "/definitions/foo", ""); + EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN( + entries, 2, "/definitions/foo/properties/bar", "/definitions/foo"); EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN( entries, 3, "/definitions/foo/properties/bar/additionalProperties", - "/definitions/foo/properties/bar", "/bar/~?additionalProperties~/~P~", - "/~?additionalProperties~/~P~"); + "/definitions/foo/properties/bar"); }