"instancePointer" incorrect in new-style ("hierarchical", "list") output
As I was trying to implement the new list output, I realized that there's a subtle difference in how the instance pointer needs to be handled with applicators. I'll use an example from the jschon test suite to illustrate:
Schema:
{
"$id": "http://example.com",
"items": {"type": "integer", "description": "an item"}
}
Instance:
[1, 2]
In the old-style ("basic", "detailed", "verbose") output units, each unit was at the keyword level. So the correct set of output units (regardless of how they appear in each format) was:
[
{
"instanceLocation": "",
"keywordLocation": "/items",
"absoluteKeywordLocation": "http://example.com#/items",
"annotation": true
},
{
"instanceLocation": "/0",
"keywordLocation": "/items/description",
"absoluteKeywordLocation": "http://example.com#/items/description",
"annotation": "an item"
},
{
"instanceLocation": "/1",
"keywordLocation": "/items/description",
"absoluteKeywordLocation": "http://example.com#/items/description",
"annotation": "an item"
}
]
However, the new output units are at the schema level. The problem being that items as a keyword applies to the entire array (instance location ""). But the items submschema applies separately to each instance location. So in the new formats, the units look like this:
[
{
"instanceLocation": "",
"evaluationPath": "",
"schemaLocation": "http://example.com#",
"annotations": {
"items": true
}
},
{
"instanceLocation": "/0",
"evaluationPath": "/items",
"schemaLocation": "http://example.com#/items",
"annotations": {
"description": "an item"
}
},
{
"instanceLocation": "/1",
"evaluationPath": "/items",
"schemaLocation": "http://example.com#/items",
"annotations": {
"description": "an item"
}
}
]
@marksparkza I am sadly under the weather this week (~~not COVID, according to my latest test~~ yup, it's COVID... whee!) so it might take a bit longer for me to fix this (for the hierarchical format) and post the PR for the list format (issue #51). Since this is all experimental, there's clearly no need to delay 0.10.0, but I'd argue this should go into 0.10.1.
The fix seems slightly tricky b/c it changes how result objects align with output, but that may just be because my head is feeling very clogged today. Hopefully it will be straightforward to fix within the next week.
yup, it's COVID
Gah! Hope you get better soon! I'm aiming to do the 0.10.0 release tomorrow, but there's no particular rush to do 0.10.1, so whenever you're ready.
Looking forward to the 0.10.0 release today/tomorrow! I'm on Paxlovid, and things aren't too bad. If it hadn't been for the muscle soreness I wouldn't have really noticed it beyond being a mild cold.
I have partially figured this out- it has to do with how keywords like items and additionalProperties that apply a subschema to multiple instance locations are handled in terms of results, combined with how the code tries to handle the difference between JSONSchema Result.schema_nodes and non-JSONSchema Result.schema_nodes. I'm still feeling pretty tired and unfocused as I slowly get over COVID so it will take a bit longer to fix this, but I wanted to note that I've made some progress.