jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Allow skipping writing of type id if type to serialize is `defaultImpl`

Open cowtowncoder opened this issue 9 years ago • 1 comments

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.

cowtowncoder avatar Dec 06 '14 22:12 cowtowncoder