Package org.springdoc.core.providers
Class ObjectMapperProvider
java.lang.Object
io.swagger.v3.core.util.ObjectMapperFactory
org.springdoc.core.providers.ObjectMapperProvider
public class ObjectMapperProvider
extends io.swagger.v3.core.util.ObjectMapperFactory
The type Spring doc object mapper provider.
Jackson 3 mappers are immutable: the mappers of swagger-core are derived, instead of being modified, and the
derived mappers are rebuilt when the swagger-core mapper configuration changes (see
ObjectMapperFactory.generation()).
- Author:
- bnasslahsen
-
Constructor Summary
ConstructorsConstructorDescriptionObjectMapperProvider(SpringDocConfigProperties springDocConfigProperties) Instantiates a new Spring doc object mapper. -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.databind.ObjectMappercreateJson(SpringDocConfigProperties springDocConfigProperties) Create json object mapper.booleanIs openapi 31 boolean.tools.jackson.databind.ObjectMapperJson mapper object mapper.tools.jackson.databind.ObjectMapperJson mapper used to write the OpenAPI description, following the springdoc writer properties.static voidregisterModules(tools.jackson.databind.JacksonModule... modules) Registers modules with every mapper built by swagger-core, including the ones swagger-core uses to introspect the models, and the mappers of this provider.static tools.jackson.databind.ObjectMappersortOutput(tools.jackson.databind.ObjectMapper objectMapper, SpringDocConfigProperties springDocConfigProperties) Sort output.static booleanunregisterModules(tools.jackson.databind.JacksonModule... modules) Unregisters modules previously registered withregisterModules(JacksonModule...).tools.jackson.databind.ObjectMapperYaml mapper object mapper.tools.jackson.databind.ObjectMapperYaml mapper used to write the OpenAPI description, following the springdoc writer properties.Methods inherited from class io.swagger.v3.core.util.ObjectMapperFactory
addCustomizer, addModule, addModules, applyCustomizers, buildStrictGenericObjectMapper, clearCustomizers, create, createJson, createJson, createJson31, createJson31, createJsonConverter, createYaml, createYaml, createYaml, createYaml31, createYaml31, generation, getCustomizers, isJackson2Compatibility, removeCustomizer, setJackson2Compatibility
-
Constructor Details
-
ObjectMapperProvider
Instantiates a new Spring doc object mapper.- Parameters:
springDocConfigProperties- the spring doc config properties
-
-
Method Details
-
createJson
public static tools.jackson.databind.ObjectMapper createJson(SpringDocConfigProperties springDocConfigProperties) Create json object mapper.- Parameters:
springDocConfigProperties- the spring doc config properties- Returns:
- the object mapper
-
registerModules
public static void registerModules(tools.jackson.databind.JacksonModule... modules) Registers modules with every mapper built by swagger-core, including the ones swagger-core uses to introspect the models, and the mappers of this provider. Each module is registered once.- Parameters:
modules- the modules
-
unregisterModules
public static boolean unregisterModules(tools.jackson.databind.JacksonModule... modules) Unregisters modules previously registered withregisterModules(JacksonModule...).- Parameters:
modules- the modules- Returns:
trueif at least one of the modules was registered
-
sortOutput
public static tools.jackson.databind.ObjectMapper sortOutput(tools.jackson.databind.ObjectMapper objectMapper, SpringDocConfigProperties springDocConfigProperties) Sort output.- Parameters:
objectMapper- the object mapperspringDocConfigProperties- the spring doc config properties- Returns:
- a copy of the object mapper, sorting the properties and map entries
-
jsonMapper
public tools.jackson.databind.ObjectMapper jsonMapper()Json mapper object mapper.- Returns:
- the object mapper
-
yamlMapper
public tools.jackson.databind.ObjectMapper yamlMapper()Yaml mapper object mapper.- Returns:
- the object mapper
-
jsonWriterMapper
public tools.jackson.databind.ObjectMapper jsonWriterMapper()Json mapper used to write the OpenAPI description, following the springdoc writer properties.- Returns:
- the object mapper
-
yamlWriterMapper
public tools.jackson.databind.ObjectMapper yamlWriterMapper()Yaml mapper used to write the OpenAPI description, following the springdoc writer properties.- Returns:
- the object mapper
-
isOpenapi31
public boolean isOpenapi31()Is openapi 31 boolean.- Returns:
- the boolean
-