|
|
@@ -36,12 +36,13 @@ public:
|
|
|
return std::nullopt;
|
|
|
}
|
|
|
|
|
|
- detail::Reference canonicalize(detail::Reference const & ref) const {
|
|
|
+ detail::Reference canonicalize(detail::Reference const & ref, bool allow_equality = false) const {
|
|
|
if (canonical_to_absolute_.contains(ref.root())) {
|
|
|
return ref;
|
|
|
}
|
|
|
|
|
|
- auto it = absolute_to_canonical_.upper_bound(ref);
|
|
|
+ auto it = allow_equality ? absolute_to_canonical_.lower_bound(ref)
|
|
|
+ : absolute_to_canonical_.upper_bound(ref);
|
|
|
if (it == absolute_to_canonical_.end()) {
|
|
|
return ref;
|
|
|
}
|
|
|
@@ -58,7 +59,7 @@ public:
|
|
|
detail::Reference const & parent) const {
|
|
|
// Relative URI, not in the HEREDOC (or we set an $id)
|
|
|
if (ref.uri().empty() and ref.anchor().empty()) {
|
|
|
- return detail::Reference(canonicalize(parent).root(), ref.pointer());
|
|
|
+ return detail::Reference(canonicalize(parent, true).root(), ref.pointer());
|
|
|
}
|
|
|
|
|
|
// TODO(samjaffe): Clean this clause up
|