Class JavaNullablePropertyCustomizer

java.lang.Object
org.springdoc.core.customizers.AbstractNullablePropertyCustomizer
org.springdoc.core.customizers.JavaNullablePropertyCustomizer
All Implemented Interfaces:
io.swagger.v3.core.converter.ModelConverter

public class JavaNullablePropertyCustomizer extends AbstractNullablePropertyCustomizer
Marks schema properties as nullable for Java class properties that are explicitly annotated with a @Nullable annotation (e.g. JSpecify, Spring, JSR-305), either on the field, its getter / record accessor, or its constructor parameter. Both declaration and type-use annotations are supported.
Author:
Mattias-Sehlstedt
See Also:
  • Constructor Details

    • JavaNullablePropertyCustomizer

      public JavaNullablePropertyCustomizer(ObjectMapperProvider objectMapperProvider)
      Instantiates a new Java nullable property customizer.
      Parameters:
      objectMapperProvider - the object mapper provider
  • Method Details

    • findNullableProperties

      protected Set<String> findNullableProperties(com.fasterxml.jackson.databind.JavaType javaType)
      Finds the serialized names of the properties explicitly annotated as nullable.
      Specified by:
      findNullableProperties in class AbstractNullablePropertyCustomizer
      Parameters:
      javaType - the java type
      Returns:
      the set of nullable property names