-
-
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
When a TypeReference
is provided, @JsonTypeInfo
should be ignored.
#2063
Comments
I think this is fundamentally conflicting with the main idea of |
My argumentation in this case would be that annotations are a generic way, and here generic is used with the sense of broad, general, to express a configuration. Using a declarative approach in the code is more granular and usually, the granular configuration should have precedence over the general/broad one. BTW, can you please point me to some documentation on how to suppress JsonTypeInfo? Thanks! |
Ideally you avoid But if you need to mask existing annotation, this can be done by custom As to behavior itself: Having said all that, overriding of just the root value type might be doable. |
Hmmh. Quickly looking at the test case, I am not quite sure this can be supported after all. But... unless this is radically simplified version, do you think you actually need |
@cowtowncoder , thanks for the prompt replies. Yes, this is a over simplified example in which And yes, the MixIn approach was something I was looking at. |
TypeReference
is provided, @JsonTypeInfo
should be ignored.
I think #2968 covers this: marking that one as "most-wanted", closing this. |
In case of a deserialization where a TypeReference is provided, the deserializer should favor the type reference information in the detriment of a possible JsonTypeInfo annotation.
Since the information related to the concrete types to be used for deserialization is provided in a declarative way, it makes much more sense to override whatever strategy a
@JsonTypeInfo
annotation enforces.POC
The text was updated successfully, but these errors were encountered: