Skip to content

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

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

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

Conversation

@staging-devin-ai-integration
Copy link

Respect $ref sibling semantics for default/examples by draft

Summary

This PR makes the ValidDefault and ValidExamples linter rules draft-aware when the keyword appears as a sibling of $ref.

What changed

  • In Draft 7 and older, if a schema object contains both $ref and:

    • default (for ValidDefault), or
    • examples (for ValidExamples)

    the rule now skips linting/transforming that object (because siblings of $ref must be ignored in those drafts).

  • In 2019-09 and 2020-12, the rules continue to lint those siblings and will still remove invalid default / examples values.

Tests added

For both valid_default and valid_examples, new tests cover:

  • Draft-07: sibling is preserved (ignored)
  • 2019-09: invalid sibling is removed
  • 2020-12: invalid sibling is removed

Local verification

  • Ran make configure compile
  • Ran make (including tests); passed

Review & Testing Checklist for Human

  • Confirm the dialect detection via vocabularies (meta-data vocab presence) is the right signal for distinguishing 2019-09+/2020-12 from Draft-07/06/04 in all linter execution paths.
  • Review the new guard in both ValidDefault::condition and ValidExamples::condition to ensure the scope is correct (only $ref sibling cases, no unintended skips).
  • Run/inspect blaze.linter tests (or full make) and verify the new draft-specific cases match expected JSON Schema semantics end-to-end.

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