-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Feature Description
I want to configure the RequiredMode for annotation @Schema programatically to REQUIRED. Right now, most of the attributes we use are required, like 95%, and other are not required.
Use Case
When I am making an application with backend and frontend, most of the times the frontend wants to see every attribute as a response from the backend.
Right now we have to configure that (or use another annotations, like @NotNull) to do that.
Suggested Solution (optional)
There should be a way to overload the default value to a specified value, when not stated otherwise.
If a value is declared in the annotation, e.g.
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED
then Swagger should ignore the default value and use the one declared.
Otherwise use the default value.
Alternatives Considered
I have tried to do this with Spring Boot annotation @NotNull, OpenAPICustomizer and a custom meta-annotation.
Additional Context
I use Spring Boot v4.
SpringDOC OpenAPI Starter WebMVC UI v2.8.10
Checklist
- I have searched the existing issues to ensure this is not a duplicate.
- This feature would be useful to more than just my use case.
- I have provided enough detail for the maintainers to understand the scope of the request.