Skip to content

Instantly share code, notes, and snippets.

@kasei
Last active January 3, 2020 04:51
Show Gist options
  • Save kasei/d4d6cecfeafcf6299bc145039b382123 to your computer and use it in GitHub Desktop.
Save kasei/d4d6cecfeafcf6299bc145039b382123 to your computer and use it in GitHub Desktop.
JSON-LD 1.1 issue with double-`@graph` expansion

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.

@gkellogg
Copy link

gkellogg commented Jan 3, 2020

Understood, but it’s a big change coming late.

I think we can move the end steps to the API description, which has its own steps. All API methods that depend on expansion use the API expand() method entrypoint.

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