Repository navigation
fix(core): only drop whole keyword segments in toDataPathSegments - #2675
Merged
lucas-koehler merged 3 commits intoNov 25, 2026
Merged
lucas-koehler merged 3 commits into
lucas-koehler merged 3 commits into
Conversation
The anyOf/allOf/oneOf and then/else regexes matched inside property names (something_else, strengthen) and also removed properties literally named then or else. Walk the pointer segment by segment instead and only skip keywords where a keyword is expected. Fixes eclipsesource#2664
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
lucas-koehler
left a comment
Contributor
There was a problem hiding this comment.
Hi @trackoor , thank you for the contribution ❤️
The PR already looks pretty good to me. I have two comments inline (one of them being optional). Please have a look.
Contributor
Author
|
Thanks for catching both! You're right about |
lucas-koehler
approved these changes
Nov 25, 2026
lucas-koehler
left a comment
Contributor
There was a problem hiding this comment.
LGTM now 🚀 Thanks for the updates and the contribution ❤️
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.
Fixes #2664.
toDataPathSegmentsremovedanyOf/N/,allOf/N/,oneOf/N/andthen//else/with regexes over the whole scope string, so they also matched inside property names (something_elsebecamesomething_properties) and removed properties that are literally namedthenorelse.It now splits the scope into segments first and walks them: a combinator keyword followed by an index and a
then/elsesegment are skipped where a keyword is expected, and the segment afterpropertiesis always taken as the property name.One output changes: a scope that ends in a combinator index.
#/properties/a/anyOf/0used to givea.0and now givesa(same foroneOfandallOf).anyOf/Ndoesn't add a data level, soais the correct data path; the old result only came from the regex requiring a trailing slash. Other existing paths give the same output as before.The PR also fixes
decode:.replace(/~0/, '~')had nogflag, so only the first~0in a segment was decoded (a~0b~0cgavea~b~0c).~1already used thegflag.Tests added to
packages/core/test/util/path.test.ts:then/else, and properties namedthen,elseandanyOfanyOf/N,oneOf/NandallOf/NdecodeandtoDataPathwith repeated~0and~1escapes in one segmentThe full core suite (450 tests, plus 1 known failure) and
eslint .inpackages/corepass.I used an AI coding assistant to help write this; I reviewed the change and ran the tests.