Apply per-property DYNAMIC typing override to ObjectArraySerializer - #5977
Merged
cowtowncoder merged 2 commits intoMay 8, 2026
Merged
cowtowncoder merged 2 commits into
cowtowncoder merged 2 commits into
Conversation
Follow-up to FasterXML#5661 (Fix FasterXML#1515): the same _hasDynamicTypingOverride guard that was added to AsArraySerializerBase, MapSerializer and MapEntrySerializer was missed in ObjectArraySerializer.createContextual, so @JsonSerialize(typing=DYNAMIC) on Object[] properties was silently ignored under USE_STATIC_TYPING.
Member
|
Thank you, @dlwldnjs1009 ! |
ObjectArraySerializer
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 #5661 (Fix #1515).
ObjectArraySerializer.createContextual()does not honor per-property@JsonSerialize(typing=DYNAMIC). The_hasDynamicTypingOverrideguard added toAsArraySerializerBase,MapSerializer, andMapEntrySerializerin #5661 is not present inObjectArraySerializer.ObjectArraySerializerextendsArraySerializerBasedirectly (sibling toAsArraySerializerBase), so the fix did not propagate.Changes
ObjectArraySerializer.createContextual: add&& !_hasDynamicTypingOverride(ctxt, property)to the same static-typing guard sibling serializers already use.Testing
StaticTyping1515Test— addedIssue515Arraysfixture andstaticTypingForObjectArrays(), mirroring the existingIssue515Lists/Issue515Mapscases. Covers both class-level@JsonSerialize(typing=DYNAMIC)(BaseDynamic[]) and field-level annotation (@JsonSerialize(typing=DYNAMIC) public Base[] aArray).Before fix:
aArraywas serialized as[{"a":1}](Base only, field-level DYNAMIC ignored).After fix:
[{"a":1,"b":2}](Derived fields honored).