Skip to content

Add @JsonWrapped annotation#346

Open
sri-adarsh-kumar wants to merge 4 commits into
FasterXML:2.xfrom
sri-adarsh-kumar:feature/512-json-wrapped-annotation
Open

Add @JsonWrapped annotation#346
sri-adarsh-kumar wants to merge 4 commits into
FasterXML:2.xfrom
sri-adarsh-kumar:feature/512-json-wrapped-annotation

Conversation

@sri-adarsh-kumar
Copy link
Copy Markdown

Adds @JsonWrapped to jackson-annotations as part of the work done in FasterXML/jackson-databind#5715

Actual serialization/deserialization support remains in jackson-databind.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Comment thread src/main/java/com/fasterxml/jackson/annotation/JsonWrapped.java
Copy link
Copy Markdown
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, needs to add enabled property.

Not sure about usefulness of tests to be honest, but I guess they don't hurt.

Could probably just leave tests for applicability on all property accessors (Field, Method, (Constructor / Factory method) Parameter, Annotation (for annotation bundles)). Which simply needs Class definition(s) with annotation applied.
And I guess from that runtime retention checking makes sense.

sri-adarsh-kumar and others added 2 commits May 1, 2026 11:17
- Add `boolean enabled() default true` to @JsonWrapped following the
  @JsonUnwrapped pattern, to allow mix-in annotations to disable wrapping
- Add ElementType.ANNOTATION_TYPE to @target (matches @JsonUnwrapped)
- Update Javadoc to document enabled=false as the canonical override idiom
- Replace tests with structural/retention checks covering Field, Method,
  Constructor Parameter, and Annotation targets (per maintainer feedback)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@cowtowncoder cowtowncoder added 2.23 and removed 2.22 labels May 4, 2026
@cowtowncoder
Copy link
Copy Markdown
Member

Marking as inclusion in 2.23; will explain in databind issue.

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.

2 participants