Skip to content

Instantly share code, notes, and snippets.

@kasei
Created January 2, 2020 17:22
Show Gist options
  • Save kasei/53002ac412d824fc2bcf0edca4eec4ff to your computer and use it in GitHub Desktop.
Save kasei/53002ac412d824fc2bcf0edca4eec4ff to your computer and use it in GitHub Desktop.
Issue with JSON-LD 1.1 optimization of @list

Expansion step 13.11 says:

If container mapping includes @list and expanded value is not already a list object, convert expanded value to a list object by first setting it to an array containing only expanded value if it is not already an array, and then by setting it to a map containing the key-value pair @list-expanded value.

In test t0004 I believe the recursive Expansion call in 13.9 for the mylist1 key will set expanded value to:

[
	{
		"@list": []
	}
]

The text in 13.11 will then turn this into a new map:

{
	"@list": [
		{
			"@list": []
		}
	]
}

instead of the value expected by the test:

[
	{
		"@list": []
	}
]

It's not clear to me where this double-@nest structure should be simplified. It seems related to 17.2 (which simplifies @set), and possibly to 19.1 which drops maps with only @value or @list keys, but *only when active property is null or @graph (which is not the case here).

@kasei
Copy link
Author

kasei commented Jan 6, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment