Skip to content

Commit

Permalink
Merge fb38a6d into 5a23c1f
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswr committed Oct 28, 2023
2 parents 5a23c1f + fb38a6d commit bf0b652
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ParsingContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class ParsingContext {
|| scopedContext[key]['@context']['@propagate']; // Propagation is true by default

if (propagate !== false || i === keysOriginal.length - 1 - offset) {
contextRaw = scopedContext;
contextRaw = { ...scopedContext };

// Clean up final context
delete contextRaw['@propagate'];
Expand Down
10 changes: 4 additions & 6 deletions lib/entryhandler/keyword/EntryHandlerKeywordType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ export class EntryHandlerKeywordType extends EntryHandlerKeyword {
if (hasTypedScopedContext) {
// Do not propagate by default
scopedContext = scopedContext.then((c) => {
if (!('@propagate' in c.getContextRaw())) {
c.getContextRaw()['@propagate'] = false;
}
let rawContext = c.getContextRaw();

// Set the original context at this depth as a fallback
// This is needed when a context was already defined at the given depth,
// and this context needs to remain accessible from child nodes when propagation is disabled.
if (c.getContextRaw()['@propagate'] === false) {
c.getContextRaw()['@__propagateFallback'] = context.getContextRaw();
if (rawContext['@propagate'] !== true) {
rawContext = { ...rawContext, '@propagate': false, '@__propagateFallback': context.getContextRaw() };
}

return c;
return new JsonLdContextNormalized(rawContext);
});

// Set the new context in the context tree
Expand Down

0 comments on commit bf0b652

Please sign in to comment.