Add test coverage for $ref sibling handling in Draft 4, 6, and 2019-09#615
Open
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Add test coverage for $ref sibling handling in Draft 4, 6, and 2019-09#615staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
The linting rules for ValidDefault and ValidExamples already properly skip validation when $ref is present in Draft 4, 6, and 7 (as per JSON Schema spec that keywords sibling to $ref must be ignored in these versions). For 2019-09 and 2020-12, the rules correctly remove invalid default/examples values even when $ref is present (as siblings are not ignored in these versions). This commit adds additional test cases to ensure complete coverage: - Draft 6 with $ref sibling (schema unchanged) - Draft 4 with $ref sibling (schema unchanged) - Draft 2019-09 with $ref sibling (invalid values removed) Relates to: sourcemeta#493
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
This PR adds additional test coverage for the
ValidDefaultandValidExampleslinting rules to ensure complete coverage of$refsibling handling across all supported JSON Schema drafts.Background
In Draft 7 and older (Draft 4, 6, 7), JSON Schema implementations MUST ignore any keyword that is a sibling to
$ref. The linting rules already properly implement this behavior, skipping validation when$refis present in these drafts.For 2019-09 and 2020-12, siblings to
$refare NOT ignored, so the rules correctly remove invaliddefault/examplesvalues even when$refis present.The existing tests covered Draft 7 and 2020-12 cases. This PR adds tests for:
$refsibling (schema should remain unchanged)$refsibling (schema should remain unchanged)$refsibling (invalid values should be removed)Test Cases Added
ValidDefault
valid_default_15: Draft 6 with$refsibling - schema unchangedvalid_default_16: Draft 4 with$refsibling - schema unchangedvalid_default_17: Draft 2019-09 with$refsibling -defaultremovedValidExamples
valid_examples_16: Draft 6 with$refsibling - schema unchangedvalid_examples_17: Draft 2019-09 with$refsibling -examplesremovedVerification
All 42 linter tests pass:
valid_default_*testsvalid_examples_*testsAll 8 test suites in the repository pass.
Relates to: sourcemeta#493