-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Polymorphic deserialization with EXTERNAL_PROPERTY
fails if type property not marked as property
#1527
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
Comments
First things first, try with the latest patch from the batch in question: in this case, 2.7.9. |
I tried with latest patch, that is 2.7.9 and also with latest version of jackson-databind 2.8.6. But it is not working still. |
Any updates on this issue? I just tested with 2.8.8 and 2.9.0-pr3, but this still throws an exception. I found an old post on Stackoverflow with the same issue. [Edit] |
The problem here is this: private String type; as there is no indication that this field is supposed to infer a property: it is Whether this should work without annotation is an interesting question: I can see why it would be nice; the problem however is that the way properties are introspected there is likely not enough information available to add inclusion. |
EXTERNAL_PROPERTY
fails if type property not marked as property
Ah ok, hadn't noticed the missing
And I even tried adding |
@oliversaggau Ok, then there seems to be some other problem. |
Any updates on this issue? If |
@buremba Well the problem is that there IS a type identifier in there, and from databinding perspective it seems like a problem -- what is that type id for? Nothing? Why would something or someone serialize type without data being typed? So in a way I am not sure if that ought to be allowed. |
@cowtowncoder The type id may be useful by itself so don't assume that type id is there just for deserializing another value. For example, here is our use-case: |
@buremba Ok. That makes some more sense. Although I am bit worried about potential for masking issues, I guess I can see this as valid usage esp as there is no way to indicate difference like with |
@cowtowncoder Unfortunately that doesn't work. I enabled the config |
I have class as follows
Class ATypeSpecific extends TypeSpecific.
I want to deserialize JSON
{"type":"b"}
where typeSpecific will be set as null in object. But I am getting following exception:
How do I deserialize above mentioned JSON into the object? If @JsonTypeInfo requires 'typeSpecific' property during deserialization, then is there a way to add it into JSON before deserialization?
Dependency versions:
jackson-annotations: 2.7.0
jackson-core: 2.7.4
jackson-databind: 2.7.4
The text was updated successfully, but these errors were encountered: