Skip to content

Commit 5fd15a6

Browse files
committed
Add JSON-LD 1.0 error checking on new @container values.
1 parent aa31215 commit 5fd15a6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/json/ld/context.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,8 +1495,12 @@ def languages
14951495
# The result is the original container definition. For IRI containers, this is necessary to be able to determine the @type mapping for string values
14961496
def check_container(container, local_context, defined, term)
14971497
case container
1498-
when '@set', '@list', '@language', '@index', '@type', '@id', nil
1498+
when '@set', '@list', '@language', '@index', nil
14991499
# Okay
1500+
when '@type', '@id', nil
1501+
raise JsonLdError::InvalidContainerMapping,
1502+
"unknown mapping for '@container' to #{container.inspect} on term #{term.inspect}" if
1503+
@options[:processingMode] < 'json-ld-1.1'
15001504
else
15011505
raise JsonLdError::InvalidContainerMapping,
15021506
"unknown mapping for '@container' to #{container.inspect} on term #{term.inspect}"

spec/expand_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,7 @@
759759
{"http://example/label": [{"@value": "Object with @type _:bar"}], "@type": ["_:bar"]},
760760
{"http://example/label": [{"@value": "Object with @type <foo>"}], "@type": ["http://example.org/foo"]}
761761
]
762-
}
763-
])
762+
}])
764763
},
765764
"Prepends @type in object already having an @type" => {
766765
input: %({

0 commit comments

Comments
 (0)