Skip to content

Keep the root $ref when bundling a draft-04/06/07 schema - #154

Open
drishtyraghav0001 wants to merge 1 commit into
hyperjump-io:mainfrom
drishtyraghav0001:fix/bundle-legacy-root-ref
Open

drishtyraghav0001 wants to merge 1 commit into
hyperjump-io:mainfrom
drishtyraghav0001:fix/bundle-legacy-root-ref

Conversation

@drishtyraghav0001

Copy link
Copy Markdown

Fixes #145.

bundle() was following a legacy root $ref before serializing, so a draft-04/06/07 schema whose root is a $ref came back as the target document. It now keeps the entry schema and embeds the referenced document, the same way 2019-09 and 2020-12 already did.

The bundle also needs the embedded $ids in definitions to be discovered even though they sit next to that root $ref, otherwise registering the bundle can't resolve the reference on its own.

Added tests for it. They fail without the change and pass with it. npm test, lint, and type-check all pass (15284 tests).

bundle() followed a legacy root $ref before serializing, so the
entry schema was replaced by the target document. Keep the $ref
and embed the referenced document, and still discover embedded
$ids that sit next to that $ref so the bundle validates on its own.
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.

bundle() of a draft-04/06/07 schema whose root is a $ref returns the target document instead

1 participant