fix(modify):stop modified array item fields being added to schema when missing in original schema#250
Merged
danielcardoso5 merged 4 commits intomainfrom Mar 5, 2026
Conversation
…n missing in original schema
- Stop merging fields.<arrayPath>.items into the field when target may not exist - Apply item-level changes only when fieldAttrs.items is a single item schema - Only rewrite existing item properties; use create for new structure - Add test that existing array item properties can be modified Made-with: Cursor
danielcardoso5
previously approved these changes
Mar 2, 2026
Collaborator
danielcardoso5
left a comment
There was a problem hiding this comment.
Just two nits, approving, but can approve again once updated!
Contributor
|
@danielcardoso5 I've addressed your comments. We're good to go 👍 |
danielcardoso5
approved these changes
Mar 4, 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.
Pull Request
Summary
Stop merging fields..items into the schema when the target doesn’t exist. Item-level changes are applied only to existing array item schemas and only to existing properties, so conditionally omitted fields are no longer added. Adding new structure remains the responsibility of consumers (e.g. via the create property).
Changes Made
src/modify-schema.tsitems:itemsis removed from the object that gets merged into the field, so it's never merged in as a top-level attribute.fieldChanges.itemsis set, the code only applies it whenfieldAttrs.itemsis a single existing item schema (object, not tuple). It then merges item-level attributes and runsrewriteFieldsforitems.propertieson that existing item schema, so only existing item properties are modified; properties that don't exist in the original schema are not added.test/modify-schema.test.tsfields.<arrayPath>.items.propertiesthat doesn't exist in the original item schema does not add it to the final schema.Related Issues/PRs
None.
Screenshots (Before/After if applicable)
N/A.
Checklist
Note
Medium Risk
Changes core
modifySchemamerge behavior for arrayitems, which could alter existing customizations that relied on the previous (more permissive) merge semantics. Scope is limited and covered by new tests, but it affects schema mutation logic used across consumers.Overview
Fixes
modifySchemasoconfig.fields.<arrayPath>.itemsis no longer blindly merged into the field schema, preventing accidental addition of newitemsstructure/properties when they weren’t present in the original schema.Adds targeted handling to apply
itemsmutations only when the array has an existing single item schema object, and to rewriteitems.propertiesusing the same “modify-only-if-exists” behavior. New unit tests cover updating existing array item properties and ensuring missing item properties are ignored rather than created.Written by Cursor Bugbot for commit f47e576. This will update automatically on new commits. Configure here.