From e6828a2941a2ca4e79629b9ce661b25291f4b79e Mon Sep 17 00:00:00 2001 From: SimonTaurus Date: Thu, 27 Aug 2026 05:10:49 +0200 Subject: [PATCH] fix(scripts): count a scoped @context term only where it is a property Mirrors OO-LD/oold-python#135 so the reference implementation and oold-python stay in parity, and so the fix travels with validate.mjs into oold-js. Refs #149 --- scripts/schema_to_frame.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/schema_to_frame.mjs b/scripts/schema_to_frame.mjs index 2ff0070..e3ef6eb 100644 --- a/scripts/schema_to_frame.mjs +++ b/scripts/schema_to_frame.mjs @@ -64,7 +64,12 @@ export function embeddedProperties(schema) { const props = collectProps(schema); const structural = Object.keys(props).filter((k) => isEmbed(props[k])); const terms = contextTerms(schema["@context"]); - const scoped = Object.keys(terms).filter((t) => "@context" in terms[t]); + // A scoped term only counts where the schema declares a property of that name. A schema must + // reflect every $ref in its @context (OOLD-CMP-b926), including the ones reached from $defs, so + // the context carries terms for properties this schema's instances never hold; treating those + // as embeds puts a property into the derived frame that no instance can match, and framing then + // returns nothing. + const scoped = Object.keys(terms).filter((t) => "@context" in terms[t] && t in props); return [...new Set([...structural, ...scoped])]; }