Skip to content

Add @JsonWrapped annotation#346

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

Add @JsonWrapped annotation#346
sri-adarsh-kumar wants to merge 2 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.

Comment thread src/main/java/com/fasterxml/jackson/annotation/JsonWrapped.java

@cowtowncoder cowtowncoder left a comment

Copy link
Copy Markdown
Member

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.

@cowtowncoder

Copy link
Copy Markdown
Member

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

sri-adarsh-kumar and others added 2 commits July 4, 2026 20:20
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- 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>
@sri-adarsh-kumar sri-adarsh-kumar force-pushed the feature/512-json-wrapped-annotation branch from d263202 to d761882 Compare July 4, 2026 18:23
@sri-adarsh-kumar

Copy link
Copy Markdown
Author

@cowtowncoder Would you be able to approve the build step here so jackson-databind can detect the new annotation for it's build?

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