Repository navigation
feat(core): select combinator branches structurally instead of compiling them with Ajv - #2643
Open
gigibiffi84 wants to merge 1 commit into
Open
gigibiffi84 wants to merge 1 commit into
gigibiffi84 wants to merge 1 commit into
Conversation
…ing them with Ajv Combinator tab selection compiled every oneOf/anyOf/allOf branch with Ajv and then ignored all errors except the structural keywords required, additionalProperties, type, enum and const. The new isStructuralMatch evaluates exactly those keywords itself, recursively through properties, patternProperties, items, $ref, nested combinators and if/then/else. Tab selection therefore no longer depends on an Ajv instance or on code generation, so it also works under a Content Security Policy without unsafe-eval. Equivalence with the previous filtered-Ajv behaviour is covered by tests comparing both approaches keyword by keyword. Part of eclipsesource#1498 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This was referenced Oct 7, 2026
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.
Part of #1498
What changed
Combinator tab selection (
mapStateToCombinatorRendererProps, used foroneOf,anyOfandallOf) compiled every branch with Ajv and then ignored all errors except the structural keywordsrequired,additionalProperties,type,enumandconst.This PR adds
isStructuralMatchin@jsonforms/core, which evaluates exactly those keywords itself, recursively throughproperties,patternProperties,items,$ref, nested combinators andif/then/else, and uses it for branch selection. No Ajv instance and no code generation are involved anymore, so tab selection also works under a Content Security Policy withoutunsafe-eval, and it no longer depends onstate.ajvbeing present.For adopters
Branch selection behaves as before: keywords outside the structural set never influenced it, because their errors were filtered out. Two differences: unresolvable
$refs no longer log aconsole.debug, and selection works even when no Ajv instance is in state.isStructuralMatchandstructuralKeywordsare new public exports.Tests
test/util/structural.test.ts: 38 cases comparingisStructuralMatchwith the previous filtered-Ajv behaviour keyword by keyword, plus boolean schemas, unresolvable and recursive$refs, invalid regexes and undefined values.test/mappers/renderer.test.ts: the two existing combinator tests unchanged, plusrequired,additionalProperties: false, primitivetype,$refbranches, a state without Ajv, and the no-match case.🤖 Generated with Claude Code