schema-URIs with plain name identifiers cannot have derived sub-schema-URIs
fix #96
This commit is contained in:
parent
b28c15adea
commit
2cc7e9aaa5
@ -1118,6 +1118,13 @@ std::shared_ptr<schema> schema::make(json &schema,
|
||||
const std::vector<std::string> &keys,
|
||||
std::vector<nlohmann::json_uri> uris)
|
||||
{
|
||||
// remove URIs which contain plain name identifiers, as sub-schemas cannot be referenced
|
||||
for (auto uri = uris.begin(); uri != uris.end();)
|
||||
if (uri->identifier() != "")
|
||||
uri = uris.erase(uri);
|
||||
else
|
||||
uri++;
|
||||
|
||||
// append to all URIs the keys for this sub-schema
|
||||
for (auto &key : keys)
|
||||
for (auto &uri : uris)
|
||||
|
||||
6
test/issue-96/CMakeLists.txt
Normal file
6
test/issue-96/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_test_simple_schema(Issue::96
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/schema.json
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/instance.json)
|
||||
set_tests_properties(Issue::96
|
||||
PROPERTIES
|
||||
WILL_FAIL 1)
|
||||
1
test/issue-96/instance.json
Normal file
1
test/issue-96/instance.json
Normal file
@ -0,0 +1 @@
|
||||
{"top": {"value": 101}}
|
||||
23
test/issue-96/schema.json
Normal file
23
test/issue-96/schema.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"$id": "http://xxx.local/schemas/mySchema.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"topDef": {
|
||||
"$id": "#topDef_ref",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"maximum": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"top": {
|
||||
"$ref": "#/definitions/topDef"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user