Fix tuple items not getting scoped in the schema editor - #2495
Open
magic-peach wants to merge 1 commit into
Open
magic-peach wants to merge 1 commit into
magic-peach wants to merge 1 commit into
Conversation
|
Hi @magic-peach! Thanks a lot for your contribution! I noticed that the following required information is missing or incomplete: issue reference Please update the PR description to include this information. You can find placeholders in the PR template for these items. Thanks a lot! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2495 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 695 695
Branches 215 215
=========================================
Hits 695 695 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
What kind of change does this PR introduce?
A bug fix.
Issue Number:
Screenshots/videos:
None.
If relevant, did you update the documentation?
Not applicable, this only changes the schema editor's internal scoping logic.
Summary
getScopesOfParsedJsonSchemawalks a parsed schema to find where each type definition sits, so the editor knows which keywords to make interactively clickable. For an array schema, it always looked atitemsas a single schema and recursed once. Whenitemsis an array (tuple validation, used for example on the Draft 2020-12 release notes page and the JSON Schema examples page), each entry is itself a schema, so the function returned only one scope for the whole array and silently skipped every tuple entry.This checks whether
itemsis an array and, if so, recurses into each entry with an indexed path (['items'][0],['items'][1], and so on), matching how array elements are already pathed elsewhere in the editor.Does this PR introduce a breaking change?
No.
Checklist
Please ensure the following tasks are completed before submitting this pull request.