Skip to content

Commit 5b3c33c

Browse files
committed
Expand scoped contexts URLs on initial processing.
1 parent 35eea2b commit 5b3c33c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/json/ld/context.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,13 @@ def create_term_definition(local_context, term, defined,
985985

986986
if value.has_key?('@context')
987987
begin
988-
self.parse(value['@context'], override_protected: true, remote_contexts: remote_contexts, validate_scoped: false)
988+
new_ctx = self.parse(value['@context'], override_protected: true, remote_contexts: remote_contexts, validate_scoped: false)
989989
# Record null context in array form
990-
definition.context = value['@context'] ? value['@context'] : [nil]
990+
definition.context = case value['@context']
991+
when String then new_ctx.context_base
992+
when nil then [nil]
993+
else value['@context']
994+
end
991995
rescue JsonLdError => e
992996
raise JsonLdError::InvalidScopedContext, "Term definition for #{term.inspect} contains illegal value for @context: #{e.message}"
993997
end

0 commit comments

Comments
 (0)