|
@@ -122,8 +122,10 @@ public:
|
|
|
return it->second;
|
|
return it->second;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- std::optional<A> external = external_.try_load(schema);
|
|
|
|
|
- EXPECT_M(external.has_value(), "Unable to load external meta-schema " << schema);
|
|
|
|
|
|
|
+ std::string error;
|
|
|
|
|
+ std::optional<A> external = external_.try_load(schema, error);
|
|
|
|
|
+ EXPECT_M(external.has_value(),
|
|
|
|
|
+ "Unable to load external meta-schema " << schema << ": " << error);
|
|
|
EXPECT_M(external->type() == adapter::Type::Object, "meta-schema must be an object");
|
|
EXPECT_M(external->type() == adapter::Type::Object, "meta-schema must be an object");
|
|
|
|
|
|
|
|
auto metaschema = external->as_object();
|
|
auto metaschema = external->as_object();
|
|
@@ -185,12 +187,12 @@ public:
|
|
|
* As long as ref contains a valid URI/Anchor, we will return an Adapter, even
|
|
* As long as ref contains a valid URI/Anchor, we will return an Adapter, even
|
|
|
* if that adapter might point to a null JSON.
|
|
* if that adapter might point to a null JSON.
|
|
|
*/
|
|
*/
|
|
|
- std::optional<A> load(Reference const & ref, Vocabulary<A> const * vocab) {
|
|
|
|
|
|
|
+ std::optional<A> load(Reference const & ref, Vocabulary<A> const * vocab, std::string & error) {
|
|
|
if (auto it = roots_.find(ref.root()); it != roots_.end()) {
|
|
if (auto it = roots_.find(ref.root()); it != roots_.end()) {
|
|
|
return ref.pointer().walk(it->second);
|
|
return ref.pointer().walk(it->second);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- std::optional<A> external = external_.try_load(ref.uri());
|
|
|
|
|
|
|
+ std::optional<A> external = external_.try_load(ref.uri(), error);
|
|
|
if (not external) {
|
|
if (not external) {
|
|
|
return std::nullopt;
|
|
return std::nullopt;
|
|
|
}
|
|
}
|
|
@@ -467,7 +469,12 @@ private:
|
|
|
vocab_docs.emplace(vocab.substr(n));
|
|
vocab_docs.emplace(vocab.substr(n));
|
|
|
vocab.replace(n, 7, "/meta/");
|
|
vocab.replace(n, 7, "/meta/");
|
|
|
|
|
|
|
|
- auto vocab_object = external_.try_load(URI(vocab));
|
|
|
|
|
|
|
+ std::string error;
|
|
|
|
|
+ auto vocab_object = external_.try_load(URI(vocab), error);
|
|
|
|
|
+ if (!vocab_object.has_value()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
auto it = vocab_object->as_object().find("properties");
|
|
auto it = vocab_object->as_object().find("properties");
|
|
|
if (it == vocab_object->as_object().end()) {
|
|
if (it == vocab_object->as_object().end()) {
|
|
|
continue;
|
|
continue;
|