Skip to content

fix(ns-arazzo-1): refract Hyper-Schema links in JSON Schema - #5282

Open
robert-hebel-sb wants to merge 1 commit into
mainfrom
fix/ns-arazzo-1-link-description
Open

robert-hebel-sb wants to merge 1 commit into
mainfrom
fix/ns-arazzo-1-link-description

Conversation

@robert-hebel-sb

Copy link
Copy Markdown
Contributor

Arazzo's refractor specification embeds the JSON Schema 2020-12 JSONSchema visitors but not
LinkDescription. A schema with Hyper-Schema links therefore throws
TypeError: VisitorClz is not a constructor:

  • in Arazzo documents, e.g. a Workflow inputs schema with links;
  • in standalone JSON Schema 2020-12 documents parsed while Arazzo is loaded. Arazzo registers its
    refractor on the JSON Schema 2020-12 element class, so once apidom-reference's saturated
    configuration is imported (as apidom-ls does), the 2020-12 parser adapters refract with Arazzo's
    specification.

Changes

  • apidom-ns-arazzo-1/src/refractor/specification.ts: add LinkDescription from the JSON Schema
    2020-12 specification object, as the OpenAPI 3.1/3.2 and AsyncAPI 2/3 specifications already do.
  • Tests: an Arazzo document whose Workflow inputs schema has links refracts them to
    linkDescription, and the JSON Schema 2020-12 JSONSchemaElement.refract still handles links
    while Arazzo is loaded.

Verification

  • apidom-ns-arazzo-1 build / typescript:check-types / lint / test: pass (126 passing; lint 0 errors,
    9 warnings that predate this change)
  • The 3 new tests fail without the fix (VisitorClz is not a constructor)
  • apidom-parser-adapter-arazzo-json-1 / -yaml-1 tests: pass

Known gaps

  • Arazzo still assigns refract on the class it imports from apidom-ns-json-schema-2020-12, so
    that class refracts with Arazzo's specification (and Arazzo's toolbox for plugins) whenever
    Arazzo is loaded. With this fix the result is the same, but Arazzo should register its refractor
    on its own subclass. Left for a follow-up to keep this change to one entry.

Needed by JSON Schema 2020-12 support in apidom-ls (#5280): until this lands, 2020-12 documents
using Hyper-Schema links fail to parse there.

🤖 Generated with Claude Code

The Arazzo specification object embeds the JSON Schema 2020-12 `JSONSchema` visitors but not
`LinkDescription`, so a schema with Hyper-Schema `links` threw `VisitorClz is not a constructor`,
both in Arazzo documents (e.g. Workflow `inputs`) and, because Arazzo registers its refractor on
the JSON Schema 2020-12 element class, in standalone JSON Schema 2020-12 documents parsed while
Arazzo is loaded (apidom-reference's saturated configuration, apidom-ls). Add `LinkDescription`
from the JSON Schema 2020-12 specification, as the OpenAPI 3.1/3.2 and AsyncAPI specifications do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants