Skip to content

fix(frame): keep reference-valued properties as IRIs - #3

Merged
simontaurus merged 1 commit into
mainfrom
fix/frame-reference-embed-never
Sep 19, 2026
Merged

simontaurus merged 1 commit into
mainfrom
fix/frame-reference-embed-never

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

schemaToFrame emitted no subframe for reference-valued properties, on the assumption stated in the module header: a referenced IRI with no local triples stays { id: ... }. That assumption fails whenever the referenced node carries triples in the same graph.

Framing a Person schema whose works_for is declared {"type": "string", "format": "iri-reference"} against a graph where the employer has its own rdf:type and schema:name:

works_for: { id: 'https://example.org/acme', type: 'schema:Organization', name: 'ACME' }

An object where the schema requires a string, so the framed document fails the very schema the frame was derived from. OOLD-EXT-68fa already requires @embed: @never here, and the worked example in the specification's #framing section already prints it.

Reference signals: x-oold-range, an IRI-family format (the family OOLD-EXT-6ea3 recommends), or a term mapped "@type": "@id". Embedding wins where a property carries both.

keywordAliasKeys excludes keys that alias a JSON-LD keyword. id typically carries "format": "iri" and so matches the reference signals, but a subframe there writes { "@id": {...} }, which a processor rejects. The alias is searched through allOf because a dereferenced subclass chain keeps each superclass's context on its own member and the convention is declared by the base schema. The Python port caught this against the shared corpus.

Tests

First tests in this repo, run with npm test (node's built-in runner, no new dependency). Covering the specification's worked example, both-signals precedence, the keyword alias, and the round-trip above including an Ajv check that the framed output validates.

Removing only the @never line fails 3 of 5 with the expected messages, so they are not vacuous.

Paired with OO-LD/oold-python for the port. Refs OO-LD/oold-schema#160.

A derived frame carried no subframe for reference-valued properties, on the
assumption that a referenced IRI has no local triples. Where the target does
carry triples in the same graph, framing embedded it as an object and the
framed document stopped validating against the schema the frame came from,
which declares a string there.

Reference signals per OOLD-EXT-68fa: x-oold-range, an IRI-family format, or a
term mapped "@type": "@id". Embedding wins where a property carries both.

Adds the first tests in this repo, covering the worked example from the
specification's #framing section.

Refs OO-LD/oold-schema#160
@simontaurus
simontaurus force-pushed the fix/frame-reference-embed-never branch from 071e4d8 to f73efc9 Compare September 19, 2026 13:41
@simontaurus
simontaurus merged commit a44a319 into main Sep 19, 2026
1 check passed
@simontaurus
simontaurus deleted the fix/frame-reference-embed-never branch September 19, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant