Skip to content

Don't lint $ref siblings for default/examples in Draft 7 and older#603

Open
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
evalon/blaze-dont-0c822cc1
Open

Don't lint $ref siblings for default/examples in Draft 7 and older#603
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
evalon/blaze-dont-0c822cc1

Conversation

@staging-devin-ai-integration
Copy link

Skip default/examples $ref siblings in Draft 7 and older

Summary

This PR updates the ValidDefault and ValidExamples linter rules to respect JSON Schema draft semantics for $ref siblings:

  • Draft 7 and older: if a schema object has $ref, the linter now skips linting default / examples siblings (they must be ignored by implementations).
  • 2019-09 and 2020-12: existing behavior is preserved, so invalid default / examples siblings to $ref are still detected and removed.

It also adds regression tests for both rules covering:

  • Draft-07 $ref sibling preservation
  • Draft 2019-09 $ref sibling removal
  • Draft 2020-12 $ref sibling removal

Review & Testing Checklist for Human

  • Verify the dialect gating logic in ValidDefault::condition and ValidExamples::condition matches intended draft behavior (especially how vocabularies are populated).
  • Confirm the new tests reflect the exact requirement: preserve in Draft-07, remove in 2019-09 and 2020-12 for invalid $ref siblings.
  • Run an end-to-end lint/transform pass on representative schemas across drafts (Draft-07, 2019-09, 2020-12) to ensure there are no unexpected changes outside these two keywords.

Recommended test plan:

  1. Run make configure compile
  2. Run make
  3. Manually inspect transformed output for schemas with { "$ref": ..., "default": ... } and { "$ref": ..., "examples": [...] } in Draft-07 vs 2019-09/2020-12

Notes

Co-Authored-By: bot_apk <apk@cognition.ai>
@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