-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force root wrapping per class #1022
Comments
Hey @cowtowncoder any news on this? |
@jam01 I haven't worked on this. And just so you know, whenever I do work on issues, I will add notes either directly or via references from commits, so asking for update is rarely if ever going to give different answer. |
Notes:
|
@cowtowncoder I'm facing the same issue here . Any solution ? |
Is there any workaround for this? In #33 You mentioned |
@OndraZizka I don't remember much more than the fact that it was not trivial to propagate. Indicating (perhaps via additional property for |
I am looking at
Which suggests that Edit: I see. It's only in |
Seems that the place to change is in
And maybe Edit: So, if it could differentiate between Is this solution viable? |
I don't think But changing the type of value stored in root-name cache in itself would be fine; that need not be |
Right. I would change the logic this way:
|
Also, I think that the current implementation of wrapping into clasname by default default is a bit buggy.
Which I can't workaround no matter what I try, because it's happening internally. I have created #2351, hope that makes sense. |
Ok, just to make sure: while it is possible to add new features (although I want to keep number limited since they need to fit in 32-bit int for now), we can not remove or rename existing ones (or change behavior), at least until 3.0. Other than that, this approach could work. Issue with reading trees is probably a bug (as per my notes, Tree Model should just skip wrap/unwrap handling altogether): wrapping/unwrapping specifically relates to Bean/POJO handling. |
(note: moved from FasterXML/jackson-annotations#33 filed by @chrylis -- see there for longer discussion)
I'm working on mapping an external service that sends postbacks in wrapped JSON. I have set the @JsonRootName on the class and can read objects with a specially-configured mapper, but this wrapping behavior belongs to this service (i.e., a certain set of classes) specifically, and not to the overall system (Spring MVC, which expects a single mapping configuration).
Since it's known that this class will always need to be unwrapped, and request classes wrapped, it would be much clearer to be able to force root wrapping per class, perhaps with an alwaysWrap field on the @JsonRootName annotation. Is this a feasible feature?
The text was updated successfully, but these errors were encountered: