Conversation
The default base direction is part of the active context (JSON-LD 1.1 API, Context Processing) and must survive cloning like the default language does. Previously any context layer processed on top of an existing active context - a second document-level layer, a scoped context, an embedded node context, or a remote context - silently dropped the inherited @direction while @language survived. Fixes digitalbazaar#586.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #586.
What
_cloneActiveContextcopies@base,@language, and@vocabonto the child context but not@direction, so the default base direction is silently dropped whenever a context layer is processed on top of an existing active context — a second document-level@contextlayer, a property-/type-scoped context, an embedded node@context, or a remote context. The default language is inherited correctly in all of those cases; only@directionis lost. Per JSON-LD 1.1 API Context Processing step 1, processing starts from a clone of the active context, whose definition includes the optional default base direction, and step 5.8 only modifies it when the context has a@directionentry.This PR adds the missing copy, mirroring the
@languagehandling. Explicitly setting or clearing@directionin a layer already worked; only inheritance was broken.Tests
tests/misc.js(@direction inheritance): survival across document-level layers, inheritance into a property-scoped context, and scoped override /nullreset still working.@directionacross layers (presumably why this went unnoticed), so local tests it is; happy to propose a json-ld-api suite test separately if useful.npm test, with all four fetched suites): same results as unpatchedmainapart from the three new passing tests — the twofromRdfuseNativeTypesfailures (#t0027/#t0028) fail identically on unpatchedmainand are unrelated.Compatibility note
Because
jsonld-signaturesdefaultsrdfDirection: 'i18n-datatype', this changes canonical N-Quads (and therefore RDFC hashes / proof values) for signed documents that combine a default@directionwith multiple context layers or scoped contexts. Flagging for your versioning call. Related: w3c/vc-data-integrity#366.PyLD has the identical omission in
_clone_active_context; companion issue digitalbazaar/pyld#337 and matching PR digitalbazaar/pyld#338.