fix(options): Allow only known options - #265
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 990903c. Configure here.
remotecom
force-pushed
the
fix-allow-only-known-options
branch
from
July 10, 2026 17:26
990903c to
5ab33b4
Compare
danielcardoso5
force-pushed
the
fix-allow-only-known-options
branch
from
July 13, 2026 15:56
fc71e4c to
80b6e8b
Compare
Collaborator
Author
sandrina-p
reviewed
Jul 15, 2026
sandrina-p
approved these changes
Jul 15, 2026
sandrina-p
reviewed
Jul 15, 2026
sandrina-p
approved these changes
Jul 15, 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.

Follow up to #263
anyOf), then any new options provided via conditionals are accepteddeepMergeSchemasinto two separate functions:mergeSchemaBranchfor the logic of merging conditional branches,mergeFieldPropertiesto merge field properties.deepMergeSchemasdid both with mixed logicsrcfoldertest/json-schema-test-suite/failed-json-schema-test-suite.jsonis not written every time we run the tests now, only via thetest:write-failed-testsscript. This fixestest:watchrunning an infinite loop, and ensures the file is only written to when intendedFor the breaking change, if a field is declared the following way:
Then conditionals can only conditionally apply the options in the base enum, a subset or all of
"enum": ["read", "write", "all"]. Any new value likeupdatewon't be accepted. The schema validates against both the baseenumand the conditionalenum. This applies even if the base enum is declared as an empty array.However, if the key
enumdoesn't exist at all, then a conditional can add anyenumoption it wants. So if the schema is:then a conditional can set
permissions.enum: ["update"]and it will accept that new option.Note
Medium Risk
Breaking behavior for schemas that relied on conditionals to introduce new options; core mutation/validation path changed with broad test coverage.
Overview
Breaking change: When
if/then/else(orallOf) branches merge into a field schema,enum,oneOf,anyOf, andoptionscan only narrow or relabel values already declared on the base property—conditionals can no longer inject new option values. Field updates after validation use a separate merge path so option lists can still be fully replaced when reverting conditionals.deepMergeSchemasis split intomergeSchemaBranch(conditional schema merge with option filtering) andmergeFieldProperties(in-place field updates);mutations.tscalls the new APIs.Tooling: Jest
rootsincludessrcfor watch mode; JSON Schema Test Suite failure tracking writesfailed-json-schema-test-suite.jsononly whenSHOULD_WRITE_FAILED_TESTS_TO_FILE=truevia newtest:write-failed-testsscript (avoids watch loops and accidental overwrites).Reviewed by Cursor Bugbot for commit fc71e4c. Bugbot is set up for automated code reviews on this repo. Configure here.