Skip to content

Allow skipping writing of type id if type to serialize is defaultImpl #644

@cowtowncoder

Description

@cowtowncoder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions