Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

Commit

Permalink
Add version announcement requirement. Version must be set explicitly …
Browse files Browse the repository at this point in the history
…either using `processingMode` API option set to "json-ld-1.1", or `"@Version": 1.1` in the first encountered JSON Object context, otherwise processing mode set implicitly to "json-ld-1.0". Added checks with expected errors in context processing if new features used in context with the wrong processing mode. Also adds compact/expand tests to check for proper error reporting.

Fixes #446.
  • Loading branch information
gkellogg committed Apr 8, 2017
1 parent cb1b3da commit c4e27a9
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 0 deletions.
47 changes: 47 additions & 0 deletions error-manifest.jsonld
Expand Up @@ -382,6 +382,53 @@
"context": "error-n007-context.jsonld",
"expect": "invalid @nest value",
"option": {"processingMode": "json-ld-1.1"}
}, {
"@id": "#tp001",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Processing mode is implicitly json-ld-1.0",
"purpose": "If not specified using processingMode, processing mode is taken as json-ld-1.0",
"input": "error-p001-in.jsonld",
"expect": "invalid container mapping"
}, {
"@id": "#tp002",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "processingMode json-ld-1.0 conflicts with @version: 1.1",
"purpose": "If not specified using processingMode, processing mode is taken as json-ld-1.0",
"input": "error-p002-in.jsonld",
"expect": "processing mode conflict",
"option": {"processingMode": "json-ld-1.0"}
}, {
"@id": "#tp003",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "@version must be 1.1",
"purpose": "If @version is specified, it must be 1.1",
"input": "error-p003-in.jsonld",
"expect": "invalid @version value"
}, {
"@id": "#tp004",
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
"name": "Processing mode is implicitly json-ld-1.0",
"purpose": "If not specified using processingMode, processing mode is taken as json-ld-1.0",
"input": "error-p004-in.jsonld",
"context": "error-p004-context.jsonld",
"expect": "invalid container mapping"
}, {
"@id": "#tp005",
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
"name": "processingMode json-ld-1.0 conflicts with @version: 1.1",
"purpose": "If not specified using processingMode, processing mode is taken as json-ld-1.0",
"input": "error-p005-in.jsonld",
"context": "error-p005-context.jsonld",
"expect": "processing mode conflict",
"option": {"processingMode": "json-ld-1.0"}
}, {
"@id": "#tp006",
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
"name": "@version must be 1.1",
"purpose": "If @version is specified, it must be 1.1",
"input": "error-p006-in.jsonld",
"context": "error-p006-context.jsonld",
"expect": "invalid @version value"
}
]
}
10 changes: 10 additions & 0 deletions error-p001-in.jsonld
@@ -0,0 +1,10 @@
{
"@context": {
"@vocab": "http://example/",
"idmap": {"@container": "@id"}
},
"idmap": {
"http://example.org/foo": {"label": "Object with @id <foo>"},
"_:bar": {"label": "Object with @id _:bar"}
}
}
5 changes: 5 additions & 0 deletions error-p002-in.jsonld
@@ -0,0 +1,5 @@
{
"@context": {
"@version": 1.1
}
}
5 changes: 5 additions & 0 deletions error-p003-in.jsonld
@@ -0,0 +1,5 @@
{
"@context": {
"@version": 1.0
}
}
7 changes: 7 additions & 0 deletions error-p004-context.jsonld
@@ -0,0 +1,7 @@
{
"@context": {
"@vocab": "http://example/",
"ex": "http://example.org/",
"idmap": {"@container": "@id"}
}
}
5 changes: 5 additions & 0 deletions error-p004-in.jsonld
@@ -0,0 +1,5 @@
[{
"http://example/idmap": [
{"http://example/label": [{"@value": "Object with @id <foo>"}], "@id": "http://example.org/foo"}
]
}]
5 changes: 5 additions & 0 deletions error-p005-context.jsonld
@@ -0,0 +1,5 @@
{
"@context": {
"@version": 1.1
}
}
1 change: 1 addition & 0 deletions error-p005-in.jsonld
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions error-p006-context.jsonld
@@ -0,0 +1,5 @@
{
"@context": {
"@version": 1.0
}
}
1 change: 1 addition & 0 deletions error-p006-in.jsonld
@@ -0,0 +1 @@
{}

0 comments on commit c4e27a9

Please sign in to comment.