Skip to content

fix: add option for new conditional options behavior - #267

Merged
danielcardoso5 merged 3 commits into
mainfrom
fix-add-new-conditional-options-option
Aug 4, 2026
Merged

fix: add option for new conditional options behavior#267
danielcardoso5 merged 3 commits into
mainfrom
fix-add-new-conditional-options-option

Conversation

@danielcardoso5

@danielcardoso5 danielcardoso5 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Follow up to the breaking change introduced in #265.

It adds a new disallowNewConditionalOptions(defaults to false) that allows to opt into the breaking change behavior: disallowing new conditional options from being introduced by conditional logic.

This ensures existing usage does not break when #265 is released.


Note

Medium Risk
Changes how conditional schemas affect field options and validation for consumers who opt in or rely on introducing new options via branches; default behavior is preserved but deprecation warnings may surface in production consoles.

Overview
Adds disallowNewConditionalOptions to createHeadlessForm (default false) so teams can adopt stricter conditional option merging without a breaking release.

With the flag true, mergeSchemaBranch only keeps branch enum / oneOf / anyOf / presentation options that already exist on the base field (narrow or re-label); values the branch adds are dropped. If the base has no option array for that key, branch options can still be applied. With the default false, branches still replace option arrays wholesale (legacy), but a one-time console.warn points callers at the new flag when a branch would add options not on the base.

Conditional rule application now passes full CreateHeadlessFormOptions into mergeSchemaBranch via mutations.ts. MIGRATING.md documents the migration path; tests cover both modes. Unrelated: removes unused convertDiskSizeFromTo from utils.

Reviewed by Cursor Bugbot for commit 6db7a33. Bugbot is set up for automated code reviews on this repo. Configure here.

@danielcardoso5 danielcardoso5 changed the title Fix add new conditional options option fix: add new option to opt into new conditional options behavior Jul 24, 2026
@danielcardoso5 danielcardoso5 changed the title fix: add new option to opt into new conditional options behavior fix: add option for new conditional options behavior Jul 24, 2026
@danielcardoso5
danielcardoso5 marked this pull request as ready for review July 24, 2026 16:36
@danielcardoso5

Copy link
Copy Markdown
Collaborator Author

Internal pipeline 🟢

Comment thread src/utils.ts Outdated
sandrina-p
sandrina-p previously approved these changes Jul 27, 2026

@sandrina-p sandrina-p left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Just a comment on the warning msg, but besides that it looks great. Thanks for updating the MIGRATING.md file too ^.^

@danielcardoso5
danielcardoso5 merged commit c5ce18b into main Aug 4, 2026
6 checks passed
@danielcardoso5
danielcardoso5 deleted the fix-add-new-conditional-options-option branch August 4, 2026 12:23
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.

3 participants