Keep references intact when canonicalizing Draft 3 schemas - #1091
Open
Vansh-kap-98 wants to merge 1 commit into
Open
Vansh-kap-98 wants to merge 1 commit into
Vansh-kap-98 wants to merge 1 commit into
Conversation
type_union_distribute_keywords copied a keyword into several type union branches, duplicating any reference the value held or pointed into, and only one copy was ever repaired. It now wraps in those cases, as it already does for identifiers. dependencies_to_extends_disallow moved each dependency schema into an implication wrapper without rewriting references, so a pointer into dependencies was lost outright. It now reports where each schema landed. Signed-off-by: Vansh <officialbusiness9818@gmail.com>
Vansh-kap-98
marked this pull request as ready for review
September 26, 2026 03:52
🤖 Augment PR SummarySummary: This PR preserves local references while canonicalizing Draft 3 schemas.
🤖 Was this summary useful? React with 👍 or 👎 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two rules dropped a
$refwhile rewriting a schema, changing what it accepts. Neither needs anid.type_union_distribute_keywordscopies a keyword into every type union branch it applies to. When the value holds a reference, or a reference points into it, the copy duplicates it. The canonicaliser repairs references after a transform, but only the origin it recorded beforehand, so the second copy is left pointing at a path that no longer exists and ends up as{}:{ "$schema": "http://json-schema.org/draft-03/schema#", "type": [ { "type": "object", "patternProperties": { "^a": {} } }, { "type": "object", "patternProperties": { "^b": {} } } ], "properties": { "foo": { "type": "integer" }, "bar": { "$ref": "#/properties/foo" } } } <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/sourcemeta/blaze/pull/1091?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->