首页 > 解决方案 > How to set all non nullable properties of swagger responses as required?

问题描述

I have a Spring Boot web app that exposes an openApi interface using swagger UI. Currently when I'm looking at responses schemas in the generated api docs json I see that fields that are not nullable are not marked as "required" by the framework. I'm looking for a way to globally set at least all primitive values as required, if possible also other types (like UUID for example). I'm trying to avoid the need for annotating each individual property as @NotNull or something of this sort since there are too many classes and properties and its just not going to happen.

Thanks.

标签: javaspring-bootswaggerswagger-uispringdoc-openapi-ui

解决方案


推荐阅读