In Expansion step 20, expanded result maps that contain only a @graph
entry are simplified:
If result is a map that contains only an @graph entry, set result that value.
In test t0081, I believe the expansion of the "input" key:
"input": {
"@graph": {
"value": "x"
}
}
will be simplified by step 20.
Before step 20:
{
"@graph": [
{
"http://example.org/value": [
{
"@value": "x"
}
]
}
]
}
After step 20:
[
{
"http://example.org/value": [
{
"@value": "x"
}
]
}
]
However, the expected test output seems to assume that this simplification does not happen, and contains a double-nesting of @graph
entries.
This also goes back to changes in w3c/json-ld-api#295. I think the change to always return an array came about because there is text at the end of the 1.0 algorithm, which is missing:
This paragraph, which is run after the algorithm, so is not part of the recursive algorithm, got rolled into steps 20-22. We should probably revert the change from #295 which moved these up, and go back to the 1.0 description, so that when the expansion algorithm is passed an object, it typically returns an object, and not an array. We can re-examine some of the other changes that came as a consequence of this.
I'll repeat this in w3c/json-ld-api#294.