Skip to content

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

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

Open
Mattias-Sehlstedt opened this issue Apr 26, 2025 · 0 comments · May be fixed by #21155
Open

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

Mattias-Sehlstedt opened this issue Apr 26, 2025 · 0 comments · May be fixed by #21155

Comments

@Mattias-Sehlstedt
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant