-
Notifications
You must be signed in to change notification settings - Fork 52
@JsonUnwrapped annotation is ignored when a field is an Optional #64
Comments
Yeah, I hate If this can be supported, great, but until then the work-around is to not use |
Will investigate to see if there might be an easy fix here. |
Ok, there are couple of few issues here. First one is that the way Guava Optional serializer overwrites It should be possible to work through these issues. First one needs to be tackled for other reasons (changes to how inclusion of Guava Optionals is determined wrt null, absent). |
FWIW, handling of Optionals has been changed and should be cleaner, regarding inclusion. |
Ok; this works now, as long as module does NOT use the backwards-compatible "treat Optionals as nulls" mode. This is configured via |
Consider the example:
Produces:
{"text":"hello, world!"}
Whereas the following example:
(note, that the
child
field is now Optional)Produces:
{"child":{"text":"hello, world!"}}
Such a behaviour looks a bit odd and counterintuitive. In my opinion, the output should be the same as in the first case.
The text was updated successfully, but these errors were encountered: