resolve "$ref" with relative uri correctly. fixes #9
This commit is contained in:
parent
e3d42e65c2
commit
23423ba5c1
@ -86,8 +86,10 @@ void json_uri::from_string(const std::string &uri)
|
||||
auto path = url.substr(pos);
|
||||
if (path[0] == '/') // if it starts with a / it is root-path
|
||||
path_ = path;
|
||||
else // otherwise it is a subfolder
|
||||
else { // otherwise it is a relative-path
|
||||
path_ = path_.substr(0, path_.find_last_of('/') + 1);
|
||||
path_.append(path);
|
||||
}
|
||||
|
||||
pointer_ = local_json_pointer("");
|
||||
}
|
||||
|
||||
@ -305,10 +305,10 @@ void json_validator::insert_schema(const json &input, const json_uri &id)
|
||||
// allocate create a copy for later storage - if resolving reference works
|
||||
std::shared_ptr<json> schema = std::make_shared<json>(input);
|
||||
|
||||
do {
|
||||
// resolve all local schemas and references
|
||||
resolver r(*schema, id);
|
||||
// resolve all local schemas and local and external references
|
||||
resolver r(*schema, id);
|
||||
|
||||
do {
|
||||
// check whether all undefined schema references can be resolved with existing ones
|
||||
std::set<json_uri> undefined;
|
||||
for (auto &ref : r.undefined_refs)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user