Skip to content

Apply per-property DYNAMIC typing override to ObjectArraySerializer - #5977

Merged
cowtowncoder merged 2 commits into
FasterXML:3.xfrom
dlwldnjs1009:fix-object-array-dynamic-typing-1515
May 8, 2026
Merged

cowtowncoder merged 2 commits into
FasterXML:3.xfrom
dlwldnjs1009:fix-object-array-dynamic-typing-1515

Conversation

@dlwldnjs1009

@dlwldnjs1009 dlwldnjs1009 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #5661 (Fix #1515).

ObjectArraySerializer.createContextual() does not honor per-property @JsonSerialize(typing=DYNAMIC). The _hasDynamicTypingOverride guard added to AsArraySerializerBase, MapSerializer, and MapEntrySerializer in #5661 is not present in ObjectArraySerializer. ObjectArraySerializer extends ArraySerializerBase directly (sibling to AsArraySerializerBase), 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 — added Issue515Arrays fixture and staticTypingForObjectArrays(), mirroring the existing Issue515Lists / Issue515Maps cases. Covers both class-level @JsonSerialize(typing=DYNAMIC) (BaseDynamic[]) and field-level annotation (@JsonSerialize(typing=DYNAMIC) public Base[] aArray).

Before fix: aArray was serialized as [{"a":1}] (Base only, field-level DYNAMIC ignored).
After fix: [{"a":1,"b":2}] (Derived fields honored).

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.
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.65% 📈 +0.000%
Branches branches 75.03% 📈 +0.000%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder added this to the 3.2.0 milestone May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.65% 📈 +0.000%
Branches branches 75.01% 📉 -0.020%

Coverage data generated from JaCoCo test results

@cowtowncoder
cowtowncoder merged commit 6d02893 into FasterXML:3.x May 8, 2026
6 checks passed
@cowtowncoder

Copy link
Copy Markdown
Member

Thank you, @dlwldnjs1009 !

@cowtowncoder cowtowncoder changed the title Apply per-property DYNAMIC typing override to ObjectArraySerializer Apply per-property DYNAMIC typing override to ObjectArraySerializer May 8, 2026
@dlwldnjs1009
dlwldnjs1009 deleted the fix-object-array-dynamic-typing-1515 branch May 8, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@JsonSerialize(Typing.DYNAMIC) in some cases does not override MapperFeature.USE_STATIC_TYPING

2 participants