fix-311: add a comment and a detailed test-case

This commit is contained in:
Patrick Boettcher 2024-02-05 14:16:49 +01:00
parent 396ffbb663
commit e2f3586dc6
3 changed files with 11 additions and 2 deletions

View File

@ -226,6 +226,7 @@ public:
// for each token create an object, if not already existing // for each token create an object, if not already existing
auto unk_kw = &file.unknown_keywords; auto unk_kw = &file.unknown_keywords;
for (auto &rt : ref_tokens) { for (auto &rt : ref_tokens) {
// create a json_pointer from rt as rt can be an stringified integer doing find on an array won't work
json::json_pointer rt_ptr{"/" + rt}; json::json_pointer rt_ptr{"/" + rt};
if (unk_kw->contains(rt_ptr) == false) if (unk_kw->contains(rt_ptr) == false)
(*unk_kw)[rt] = json::object(); (*unk_kw)[rt] = json::object();

View File

@ -1,3 +1,4 @@
{ {
"element": [1] "element": [1],
"element2": "test"
} }

View File

@ -3,6 +3,9 @@
"properties": { "properties": {
"element": { "element": {
"$ref": "#/$defs/element" "$ref": "#/$defs/element"
},
"element2": {
"$ref": "#/$defs/element/items/0/$defs/element2"
} }
}, },
"$defs": { "$defs": {
@ -10,7 +13,11 @@
"type": "array", "type": "array",
"items": [ "items": [
{ {
"$comment": "the comment should not lead to fail of loading schema", "$defs": {
"element2": {
"type": "string"
}
},
"type": "number" "type": "number"
} }
] ]