Skip to content

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
evalon/blaze-dont-c381c85a
Open

Add test coverage for $ref sibling handling in Draft 4, 6, and 2019-09#615
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
evalon/blaze-dont-c381c85a

Conversation

@staging-devin-ai-integration
Copy link

Summary

This PR adds additional test coverage for the ValidDefault and ValidExamples linting rules to ensure complete coverage of $ref sibling 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 $ref is present in these drafts.

For 2019-09 and 2020-12, siblings to $ref are NOT ignored, so the rules correctly remove invalid default/examples values even when $ref is present.

The existing tests covered Draft 7 and 2020-12 cases. This PR adds tests for:

  • Draft 6 with $ref sibling (schema should remain unchanged)
  • Draft 4 with $ref sibling (schema should remain unchanged)
  • Draft 2019-09 with $ref sibling (invalid values should be removed)

Test Cases Added

ValidDefault

  • valid_default_15: Draft 6 with $ref sibling - schema unchanged
  • valid_default_16: Draft 4 with $ref sibling - schema unchanged
  • valid_default_17: Draft 2019-09 with $ref sibling - default removed

ValidExamples

  • valid_examples_16: Draft 6 with $ref sibling - schema unchanged
  • valid_examples_17: Draft 2019-09 with $ref sibling - examples removed

Verification

All 42 linter tests pass:

  • 21 valid_default_* tests
  • 21 valid_examples_* tests

All 8 test suites in the repository pass.

Relates to: sourcemeta#493

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
@staging-devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants