Skip to content

ClassDiscriminatorMode annotation for data classes #2883

Open
@rattletat

Description

Hi there,

similarly to JsonClassDiscriminator, I would like an annotation type to indicate the discriminator mode for data classes:

@Serializable
@JsonClassDiscriminatorMode(ClassDiscriminatorMode.ALL_JSON_OBJECTS)
abstract class Base

The motivation is that we have a polymorphic data class consumed by third-party actors but we want to ensure that the serialized classes always include the class type annotation, regardless of whether the third-party actors serialize it using the concrete or the polymorphic type.

If there is a work-around already known, please feel free to share.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions