Skip to content

[REQ] Do not add a null-annotation on a discriminator property #21154

Open
@Mattias-Sehlstedt

Description

@Mattias-Sehlstedt

Is your feature request related to a problem? Please describe.

Null-annotations are added on model fields based upon whether a property is required or not in a specification. A discriminator property is most often required if it is present, but the preferred approach for interacting with this is that the client should not need to set it themselves, but rather that the model sets it based upon a Jackson annotation.

This means that if tooling is used that inspects these non-null annotations, then they will yield an exception since the discriminator is never set (since it is only set by Jackson when the object is serialized).

Describe the solution you'd like

Since the discriminator is set at serialization, then the discriminator property should be excluded from having an annotation.

Describe alternatives you've considered

I have considered either dropping the annotation from the discriminator, or setting the discriminator to its required value.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions