Skip to content

Add DelegatingSerializer - #5630

Merged
cowtowncoder merged 9 commits into
FasterXML:3.xfrom
mluckam:delgating_serializer
Feb 4, 2026
Merged

Add DelegatingSerializer#5630
cowtowncoder merged 9 commits into
FasterXML:3.xfrom
mluckam:delgating_serializer

Conversation

@mluckam

@mluckam mluckam commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Currently there is a DelegatingDeserializer, but no DelegatingSerializer. Was there a reason for not including a DelegatingSerializer? It would be nice to have a DelegatingSerializer for symmetry.

I am currently using the DelegatingDeserializer to add validation to the deserialize process, see example project. Since there is not a DelegatingSerializer, the same strategy cannot be applied to serialization. This is just one use case, but I figure others may also utilize deserialization strategies with the DelegatingDeserializer that could also be applied to serialization if there was a DelegatingSerializer.

Welcome any thoughts regarding the request.

@cowtowncoder

cowtowncoder commented Feb 2, 2026

Copy link
Copy Markdown
Member

Did you see StdDelegatingSerializer.java? Would that not work?

I am not sure why DelegatingDeserializer.java was NOT renamed as StdDelegatingDeserializer.java in 3.0 (would have made sense), but looks like 2.x -> 3.x there was some refactoring as 2.x had both DelegatingDeserializer.java and StdDelegatingDeserializer.java, of which latter was actually renamed as StdConvertingDeserializer.java.

EDIT: looks like StdDelegatingSerializer.java is a "converting" one, assuming existence of Converter, and what you want is "plain" delegating serializer.
And what'd be really good would be:

  • Addition of "plain" DelegatingSerializer like you propose,

but also for 3.1:

  • Deprecating StdDelegatingSerializer (as name), create StdDelegatingSerializer in its place -- effectively renaming this implementation, make old one extend new one (or vice versa).

to address naming inconsistency.

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.17% 📉 -0.040%
Branches branches 73.24% 📉 -0.040%

Coverage data generated from JaCoCo test results

Comment thread src/main/java/tools/jackson/databind/ser/std/DelegatingSerializer.java Outdated
Comment thread src/main/java/tools/jackson/databind/ser/std/DelegatingSerializer.java Outdated
@cowtowncoder

Copy link
Copy Markdown
Member

Looks good, just need to figure out how exactly to untangle naming of "delegating vs converting" (de)serializers.

I think plain Delegating[De]Serializer vs StdConvertin[De]Serializer is the goal, just need to keep 3.1 compatible with 3.0 -- 3.1 will be strict baseline for 3.x, but I don't want gratuitous breakages between 3.0 and 3.1 (but deprecating 3.0 types is fine).

@cowtowncoder

Copy link
Copy Markdown
Member

Quick note: I renamed existing class in #5631 / #5632 so there's nothing this PR needs to do wrt naming -- DelegatingSerializer is fine as-is.

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.18% 📉 -0.030%
Branches branches 73.26% 📉 -0.020%

Coverage data generated from JaCoCo test results

@mluckam
mluckam force-pushed the delgating_serializer branch from 2b551eb to bd39fee Compare February 3, 2026 13:27
@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.23% 📉 -0.030%
Branches branches 73.33% 📈 +0.000%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.36% 📉 -0.040%
Branches branches 73.55% 📉 -0.020%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder added the cla-needed PR looks good (although may also require code review), but CLA needed from submitter label Feb 3, 2026
@cowtowncoder

Copy link
Copy Markdown
Member

@mluckam Ok looks good, happy to add! Just one more thing before doing so: unless we've gotten one from your earlier (CLAs are good after submitting one), we'd need CLA.

It's from here: https://github.com/FasterXML/jackson/blob/main/contributor-agreement.pdf
and the usual way is to print, fill & sign, scan (or modify PDF for the same), email to cla at fasterxml dot com.
Once I got it I can merge this in 3.x!

Thank you again for contributing this.

@cowtowncoder cowtowncoder changed the title Add DelegatingSerializer Add DelegatingSerializer Feb 3, 2026
@mluckam

mluckam commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

CLA signed previously as part of #4483

@cowtowncoder

Copy link
Copy Markdown
Member

CLA signed previously as part of #4483

Ah. Yes, I see it now, for M. Luckam. Thanks!

@cowtowncoder cowtowncoder added cla-received PR already covered by CLA (optional label) and removed cla-needed PR looks good (although may also require code review), but CLA needed from submitter labels Feb 4, 2026
@cowtowncoder cowtowncoder added this to the 3.1.0 milestone Feb 4, 2026
@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.37% 📉 -0.030%
Branches branches 73.55% 📉 -0.020%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.38% 📉 -0.020%
Branches branches 73.56% 📉 -0.010%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.39% 📉 -0.010%
Branches branches 73.55% 📉 -0.020%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 80.41% 📈 +0.010%
Branches branches 73.57% 📈 +0.000%

Coverage data generated from JaCoCo test results

@cowtowncoder
cowtowncoder merged commit fc0693d into FasterXML:3.x Feb 4, 2026
6 checks passed
@cowtowncoder

Copy link
Copy Markdown
Member

Added some more testing coverage; fixed issues with "withXxx()" methods, merged in for 3.1.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.1 cla-received PR already covered by CLA (optional label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants