fix: keep a false property subschema when a conditional branch adds a constraint - #276
Merged
thiamsantos merged 1 commit intoSep 25, 2026
Conversation
… a constraint
When two allOf branches touch the same property — one setting it to `false`
(forbidden) and another adding a constraint like `{ maximum }` — mergeSchemaBranch
overwrote the `false` with the constraint object. The property then rendered as a
normal visible field and validation accepted a value the schema forbids.
A `false` property subschema is unsatisfiable, so allOf semantics keep the property
forbidden regardless of sibling constraints. Keep the `false` when merging property
subschemas. The check is scoped to property maps so a branch can still relax a
boolean keyword such as `additionalProperties: false`.
Fixes both the field-build path (field is now hidden) and the validation path (a
value for the forbidden property is now rejected), covered by unit tests on
mergeSchemaBranch and an integration test through createHeadlessForm.
thiamsantos
force-pushed
the
fix-property-false-overwritten-by-conditional-branch
branch
from
September 23, 2026 17:30
4ad1756 to
b710af2
Compare
thiamsantos
marked this pull request as ready for review
September 23, 2026 17:32
ollyd
self-requested a review
September 25, 2026 02:59
ollyd
approved these changes
Sep 25, 2026
thiamsantos
deleted the
fix-property-false-overwritten-by-conditional-branch
branch
September 25, 2026 13:48
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 bug where a
falseproperty subschema was dropped when anotherallOfbranch constrained the same property. The property then rendered as a normal field, and validation accepted a value the schema forbids.Changes Made
mergeSchemaBranchmerges each applied conditional branch into the base schema. When one branch set a property tofalse(forbidden) and a sibling branch added a constraint like{ maximum: 12 }, the merge overwrote thefalsewith the constraint object. Afalsesubschema is unsatisfiable, soallOfsemantics keep the property forbidden regardless of sibling constraints.falsewhen merging property subschemas instead of overwriting it.properties/patternProperties) so a branch can still relax a boolean keyword such asadditionalProperties: false.Repro (before this change,
createHeadlessFormwithcontract_duration_type: 'indefinite'):Note
Medium Risk
Changes core conditional schema merge logic used when building forms; scoped to property maps but affects visibility and validation for complex
allOfschemas.Overview
Fixes conditional
allOfmerging so afalseproperty subschema (forbidden field) is not replaced when another branch adds constraints on the same key (e.g.{ maximum: 12 }).mergeSchemaBranchnow tracks when it is merging insideproperties/patternPropertiesand skips overwriting an existingfalsesubschema in that context, matching JSON SchemaallOfsemantics. The guard is not applied to boolean keywords likeadditionalProperties, so branches can still relax those.End-to-end behavior: forbidden fields stay hidden and validation rejects values that should not be allowed when a sibling branch only constrains the same property. New unit and visibility tests cover merge edge cases and the contract-duration /
monthsscenario.Reviewed by Cursor Bugbot for commit b710af2. Bugbot is set up for automated code reviews on this repo. Configure here.