You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We have a strict no-null policy for all of our spring boot based java applications.
This means that we use javas Optional<T> everywhere where a value does not have to be, even in our api layer and records.
Since all properties are not required by default when generating the openapi spec using springdoc, we have to annotate almost everything in our api layer with @NotNull. This is very verbose and only needed for our api layer which leads to many properties that are not nullable in our application but are nullable in our openapi spec since the @NotNull annotation was forgotten.
Describe the solution you'd like
It would be great if we could specify a default required mode, i.e. everything is required unless stated otherwise.
Perfect would be if a field with Optional<?> would result in a not required property in the openapi spec.
Describe alternatives you've considered
We dabbled in extending springdoc using ModelConverts and so on but did not manage to achieve the desired behavior.
We are also looking into migrating to graphql simple because code generation from a graphql schema seems to be much easier, especially when combined with sealed types in java (algebraic data types) that have to be mapped to discriminated unions in typescript.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We have a strict no-null policy for all of our spring boot based java applications.
This means that we use javas
Optional<T>
everywhere where a value does not have to be, even in our api layer and records.Since all properties are not required by default when generating the openapi spec using springdoc, we have to annotate almost everything in our api layer with
@NotNull
. This is very verbose and only needed for our api layer which leads to many properties that are not nullable in our application but are nullable in our openapi spec since the@NotNull
annotation was forgotten.Describe the solution you'd like
It would be great if we could specify a default required mode, i.e. everything is required unless stated otherwise.
Perfect would be if a field with
Optional<?>
would result in a not required property in the openapi spec.Describe alternatives you've considered
We dabbled in extending springdoc using
ModelConverts
and so on but did not manage to achieve the desired behavior.We are also looking into migrating to graphql simple because code generation from a graphql schema seems to be much easier, especially when combined with sealed types in java (algebraic data types) that have to be mapped to discriminated unions in typescript.
The text was updated successfully, but these errors were encountered: