Skip to content

fix(core): only drop whole keyword segments in toDataPathSegments - #2675

Open
trackoor wants to merge 1 commit into
eclipsesource:masterfrom
trackoor:fix/to-data-path-keyword-segments
Open

trackoor wants to merge 1 commit into
eclipsesource:masterfrom
trackoor:fix/to-data-path-keyword-segments

Conversation

@trackoor

Copy link
Copy Markdown

Fixes #2664.

toDataPathSegments removed anyOf/N/, allOf/N/, oneOf/N/ and then//else/ with regexes over the whole scope string, so they also matched inside property names (something_else became something_properties) and removed properties that are literally named then or else.

It now splits the scope into segments first and walks them: a combinator keyword followed by an index and a then/else segment are skipped where a keyword is expected, and the segment after properties is always taken as the property name. The output for all existing paths is unchanged.

I added two tests to packages/core/test/util/path.test.ts (property names ending in then/else, and properties named then, else and anyOf). Both fail on master and pass with the change. The full core suite (447 tests) and eslint . in packages/core pass.

I used an AI coding assistant to help write this; I reviewed the change and ran the tests.

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
@CLAassistant

CLAassistant commented Nov 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@netlify

netlify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 45612c8
🔍 Latest deploy log https://app.netlify.com/projects/jsonforms-examples/deploys/6b00ffed30ae92e7fd07db9c
😎 Deploy Preview https://deploy-preview-2675--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
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.

Scope through a property whose name ends in "then" or "else" binds the control to the wrong data path

2 participants