-
Notifications
You must be signed in to change notification settings - Fork 35
Algorithm updates and tests to allow @container: @set
on @type
#41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n alias in 1.1. Remains an error to redefine `@type` in 1.0. For w3c/json-ld-syntax#34.
"name": "Keywords may not be redefined", | ||
"purpose": "Verifies that an exception is raised on expansion when processing an invalid context attempting to define @container on a keyword", | ||
"input": "expand/e042-in.jsonld", | ||
"expect": "keyword redefinition" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be in 1.0 mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test to be sure that a 1.0 processor would fail if @type
were so defined. We didn’t have good relevant tests before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If processingMode
is not set in the test definition, it defaults to 1.0. expand/e042-in.jsonld is the following:
{
"@context": {
"@type": {"@container": "@set"}
},
"@type": "http://example.org/type"
}
which a 1.0 processor should fail on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was forgetting it defaulted to 1.0.
"expect": "compact/0105-out.jsonld", | ||
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} | ||
}, { | ||
"@id": "#t0106", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this test be a negative test in 1.0 mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the tests are reasonable to check both 1.0 and 1.1 modes. The negative test is in expansion, to make sure a 1.0 processor fails. A 1.0 processor compacting with an alias of @type
will allow a @container
definition but ignore it when actually compacting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought it failed in 1.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually never checked that keyword aliases should only be for simple term definitions; we just ignore everything else. We could consider tightening these up in 1.1, and require that keyword aliases only be simple term definitions.
or an alias in 1.1. Remains an error to redefine
@type
in 1.0.For w3c/json-ld-syntax#34.