Honor @JsonValue accessor format with explicit serializers - #6269
jin-sungdae wants to merge 1 commit into
Conversation
Code Review ✅ Approved🟡 Medium risk Fixes OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Thank you for submitting this PR; I'll review it as soon as I have time. One thing needed before merging is CLA (if not yet sent); see https://github.com/FasterXML/jackson/blob/main/CONTRIBUTING.md#paperwork for details. Looking forward to merging the pr ! |
@JsonValue accessor format with explicit serializers
When a @jsonvalue accessor has both an explicit serializer and @jsonformat, the accessor's format is ignored. For example:
On current 3.x, serializing this value produces "1970-01-01T00:00:00.000Z" instead of "1970-01".
#6076 added an accessor-backed BeanProperty for dynamically or statically resolved @jsonvalue serializers, but the already-supplied serializer branch still contextualizes against only the enclosing property (or null at the root). Use the same _accessorProperty helper in that branch, preserving the existing enclosing-property precedence.
This is a follow-up to #4762 / #6076 and targets 3.x, where that helper is available. It does not introduce another annotation-merging implementation or change public APIs.
Regression coverage:
Validation on Microsoft OpenJDK 17.0.15 / Maven 3.9.9:
mvn -B -ntp clean verify: BUILD SUCCESS; 7,475 tests, 0 failures, 0 errors, 1 skipped.git diff --checkpasses.Prepared with AI assistance. The failure reproduction and verification commands above were executed locally.