Package org.springdoc.core.customizers
Class AbstractNullablePropertyCustomizer
java.lang.Object
org.springdoc.core.customizers.AbstractNullablePropertyCustomizer
- All Implemented Interfaces:
io.swagger.v3.core.converter.ModelConverter
- Direct Known Subclasses:
JavaNullablePropertyCustomizer
public abstract class AbstractNullablePropertyCustomizer
extends Object
implements io.swagger.v3.core.converter.ModelConverter
Base model converter marking the schema properties of a model as nullable, for the
properties a subclass identifies as nullable.
Handles both OAS 3.0 and OAS 3.1 nullable semantics:
- OAS 3.0: Sets
nullable: trueon the property. For$refproperties, wraps inallOfsince$refandnullableare mutually exclusive. - OAS 3.1: Adds
"null"to thetypearray, or atype: "null"alternative to aoneOf. For$refproperties, wraps inoneOfwith atype: "null"alternative.
- Author:
- Jeffrey Blayney, Mattias-Sehlstedt, bnasslahsen
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNullablePropertyCustomizer(ObjectMapperProvider objectMapperProvider) Instantiates a new Abstract nullable property customizer. -
Method Summary
Modifier and TypeMethodDescriptionfindNullableProperties(com.fasterxml.jackson.databind.JavaType javaType) Finds the names of the properties of the model that are nullable.protected ObjectMapperProviderGets object mapper provider.io.swagger.v3.oas.models.media.Schemaresolve(io.swagger.v3.core.converter.AnnotatedType type, io.swagger.v3.core.converter.ModelConverterContext context, Iterator<io.swagger.v3.core.converter.ModelConverter> chain) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.swagger.v3.core.converter.ModelConverter
isOpenapi31
-
Constructor Details
-
AbstractNullablePropertyCustomizer
Instantiates a new Abstract nullable property customizer.- Parameters:
objectMapperProvider- the object mapper provider
-
-
Method Details
-
resolve
public io.swagger.v3.oas.models.media.Schema resolve(io.swagger.v3.core.converter.AnnotatedType type, io.swagger.v3.core.converter.ModelConverterContext context, Iterator<io.swagger.v3.core.converter.ModelConverter> chain) - Specified by:
resolvein interfaceio.swagger.v3.core.converter.ModelConverter
-
findNullableProperties
protected abstract Set<String> findNullableProperties(com.fasterxml.jackson.databind.JavaType javaType) Finds the names of the properties of the model that are nullable.- Parameters:
javaType- the java type of the model- Returns:
- the names of the nullable properties, possibly empty
-
getObjectMapperProvider
Gets object mapper provider.- Returns:
- the object mapper provider
-