-
Notifications
You must be signed in to change notification settings - Fork 18.2k
fix(core): correctly resolve list indices in JSON Pointer refs and improve docs #32041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…s and add thorough docs * Handle numeric path tokens as zero-based list indices when the current node is a list, preventing false-negative look-ups and KeyErrors. * Raise explicit “index out of range” errors for invalid indices. * Keep existing dict-key resolution behaviour intact. * Tighten validation: ensure every $ref starts with “#”. * Return a deep copy of the resolved fragment to avoid accidental mutation. * Added detailed doc-string and inline comments to clarify control flow, pointer semantics, and error cases.
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
CodSpeed WallTime Performance ReportMerging #32041 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #32041 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a unit test that shows the case that breaks?
will do |
Description:
This PR fixes incorrect handling of numeric path tokens in internal JSON-Schema $ref resolution. Numeric tokens are now treated as zero-based list indices whenever the current node is a list, eliminating false-negative look-ups and spurious KeyErrors. The helper also raises an explicit “index out of range” error for invalid indices, validates that every reference starts with #, and returns a deep copy to prevent unintended mutation. A comprehensive doc-string and inline comments clarify pointer semantics, control flow, and error cases.
Issue: $ref paths with list indices (e.g. #/anyOf/0) raise KeyError in dereference_refs #32042
Dependencies:: None