Open olegshtch opened 2 years ago
I tested it this way and it worked:
{
"$defs": {
"tree": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/tree",
"$dynamicAnchor": "node",
"type": "object",
"properties": {
"data": true,
"children": {
"type": "array",
"items": {
"$dynamicRef": "#node"
}
}
}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/strict-tree",
"$dynamicAnchor": "node",
"$ref": "tree",
"unevaluatedProperties": false
}
{
"children": [ { "daat": 1 } ]
}
But I will attempt to patch your test locally and see what happens.
Maybe it doesn't work because tree
schema in other file.
Step one is to not NPE if $dynamicAnchor doesn't resolve, which is obviously bad. https://github.com/jimblackler/jsonschemafriend/commit/c2d871f19a3e83a24fdbf5ff6a3b195e0c586e0a
It doesn't fix your test case though so I'll look more into that.
OK the issue is the port spec in the URL http://localhost:1234/strict-tree.json. The library was mishandling those. https://github.com/jimblackler/jsonschemafriend/commit/e5d884a8499c820313767cc492f5e0463c0c8559 contains fixes for this specific test case (although it's possible there are more).
I've prepared test suite based on https://json-schema.org/draft/2020-12/json-schema-core.html#recursive-example in https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/521
Currently it fails with NullPointerException: