Class OpenAPIPropertyBeanValidationExtension

java.lang.Object
io.domainlifecycles.swagger.v3.OpenAPIPropertyBeanValidationExtension

public class OpenAPIPropertyBeanValidationExtension extends Object
If a bean validation implementation is provided in the classpath of the target application, then this customization extends all classes which have bean validation annotations on their properties (also non dlc domain object classes, like DTOs) with a corresponding additional open api description, if they are used in controller interfaces which provide Open API documentation OpenAPIPropertyBeanValidationExtension.

In contrast to SpringDoc default behaviour this extension adds additional detailed Open API doc information for every single default annotation of the Java Bean Validation standard 2.0 or 3.0. Additionally, this extension corrects the (in our point of view wrong) default behaviour of spring doc if properties (fields) of API classes wrap their types in Optional.

If no bean validation implementation is provided, only an info level log entry occurs. The behaviour of the application is not affected in any negative way.
  • Constructor Details

    • OpenAPIPropertyBeanValidationExtension

      public OpenAPIPropertyBeanValidationExtension()
  • Method Details

    • extendWithBeanValidationInformation

      public static void extendWithBeanValidationInformation(io.swagger.v3.oas.models.OpenAPI openAPI)
      Entry point for all Open API extension regarding bean validation annotations on class properties.
      Parameters:
      openAPI - OpenAPI instance to be extended