Skip to content

feat(serializer): merge-patch string-keyed maps (api_merge_patch_maps) - #8921

Open
soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:feat/merge-patch-maps
Open

soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:feat/merge-patch-maps

Conversation

@soyuka

@soyuka soyuka commented Dec 1, 2026

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets ~
License MIT
Doc PR ~

RFC 7396 merges JSON objects recursively, and a null member removes the key. We already do that for embedded objects, but a string-keyed array (array<string, mixed>) serializes as a JSON object and is replaced wholesale on PATCH, and its nulls are stored as values.

With denormalizationContext: ['api_merge_patch_maps' => true], PATCH deep-merges such maps and null removes a key. Validation runs on the merged value.

Opt-in because it changes behavior for existing clients. Open points:

  • it currently applies to every PATCH, it should probably only apply to application/merge-patch+json (JSON:API doesn't define deep merges)
  • deprecate the unset flag and flip the default in 6.0?

Extracted from #8868.

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.

1 participant