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

    Constructors
    Constructor
    Description
    Instantiates a new Spring doc object mapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    static tools.jackson.databind.ObjectMapper
    createJson(SpringDocConfigProperties springDocConfigProperties)
    Create json object mapper.
    boolean
    Is openapi 31 boolean.
    tools.jackson.databind.ObjectMapper
    Json mapper object mapper.
    tools.jackson.databind.ObjectMapper
    Json mapper used to write the OpenAPI description, following the springdoc writer properties.
    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.
    static tools.jackson.databind.ObjectMapper
    sortOutput(tools.jackson.databind.ObjectMapper objectMapper, SpringDocConfigProperties springDocConfigProperties)
    Sort output.
    static boolean
    unregisterModules(tools.jackson.databind.JacksonModule... modules)
    Unregisters modules previously registered with registerModules(JacksonModule...).
    tools.jackson.databind.ObjectMapper
    Yaml mapper object mapper.
    tools.jackson.databind.ObjectMapper
    Yaml 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ObjectMapperProvider

      public ObjectMapperProvider(SpringDocConfigProperties springDocConfigProperties)
      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 with registerModules(JacksonModule...).
      Parameters:
      modules - the modules
      Returns:
      true if 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 mapper
      springDocConfigProperties - 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