-
-
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
Allow skipping writing of type id if type to serialize is defaultImpl
#644
Comments
Looking at code, this may be tricky: problem is that while it seems easy to prevent writing of type id during "write type prefix" case, there is no coupling to "write type suffix" case. So it is not necessarily possible to suppress wrapping with object or array. However, this may still work ok if we just use missing type id (null or "") for cases where we can not omit structural thing (wrapper). And while |
Currently it is possible to specify "defaultImpl" for
@JsonTypeInfo
, indicating type to use in case Type Id is not available (or is invalid or unmappable). But this default type is not taken into account for serialization.It would make sense to allow omitting type id writing altogether, if actual type is the same as default type.
Due to backwards compatibility, however, it would make sense to not do this by default.
There are couple of standard ways to expose this functionality; and although more commonly we could specify
SerializationFeature
, it seems perhaps better here to configure it via new property of@JsonTypeInfo
instead.The text was updated successfully, but these errors were encountered: