Fix crash when an if.required field has a json-logic validation - #273
Merged
Merged
Conversation
thiamsantos
force-pushed
the
fix-if-required-drops-jsonlogic-context
branch
2 times, most recently
from
September 8, 2026 17:32
47d1fa6 to
fa2c83b
Compare
thiamsantos
marked this pull request as ready for review
September 8, 2026 17:56
thiamsantos
force-pushed
the
fix-if-required-drops-jsonlogic-context
branch
from
September 10, 2026 17:52
fa2c83b to
a828b20
Compare
eshiota
approved these changes
Sep 11, 2026
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.
Summary
Fixes a crash when a form field appears in a conditional's required list and also has a json-logic validation.
Why
createHeadlessForm threw required validation "" doesn't exist for a valid schema, so the form could not be built or validated. The named validation was defined at the schema root the whole time; the conditional's type-error check could not see it. This blocked any schema that pairs if.required with x-jsf-logic-validations on the same field.
How
forward jsonLogicContext (already in scope) and a path into that validateSchema call.
Note
Low Risk
Single-argument change on an internal conditional type-check path; behavior is narrowed to schemas that combine if.required with json-logic validations on the same field.
Overview
Fixes a build/validation crash when a field listed in a conditional’s
if.requiredalso declaresx-jsf-logic-validations. The type-error gate insideevaluateConditionalnow passes the existingjsonLogicContext(and path) intovalidateSchema, so json-logic rules resolve from the root schema instead of throwing that a named validation “doesn’t exist.”Adds a fixture and tests for
field_awith bothif.requiredanda_at_least_ten: form creation no longer throws, the then branch still requiresfield_calongside logic errors, and the else branch still hidesfield_cwhile logic validation runs.Reviewed by Cursor Bugbot for commit a828b20. Bugbot is set up for automated code reviews on this repo. Configure here.