Package org.springdoc.core
Class OpenAPIService
java.lang.Object
org.springdoc.core.OpenAPIService
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class OpenAPIService
extends Object
implements org.springframework.context.ApplicationContextAware
The type Open api builder.
- Author:
- bnasslahsen
-
Constructor Summary
ConstructorsConstructorDescriptionOpenAPIService
(Optional<io.swagger.v3.oas.models.OpenAPI> openAPI, SecurityService securityParser, SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils, Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomizers, Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomizers, Optional<JavadocProvider> javadocProvider) Instantiates a new Open api builder. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMappings
(Map<String, Object> mappings) Add mappings.void
addTag
(Set<org.springframework.web.method.HandlerMethod> handlerMethods, io.swagger.v3.oas.models.tags.Tag tag) Add tag.io.swagger.v3.oas.models.OpenAPI
Build.io.swagger.v3.oas.models.Operation
buildTags
(org.springframework.web.method.HandlerMethod handlerMethod, io.swagger.v3.oas.models.Operation operation, io.swagger.v3.oas.models.OpenAPI openAPI, Locale locale) Build tags operation.void
buildTagsFromClass
(Class<?> beanType, Set<io.swagger.v3.oas.models.tags.Tag> tags, Set<String> tagsStr, Locale locale) Build tags from class.io.swagger.v3.oas.models.OpenAPI
getCachedOpenAPI
(Locale locale) Gets cached open api.org.springframework.context.ApplicationContext
Gets context.Gets controller advice map.Gets mappings map.Gets security parser.Gets server base URLboolean
isAutoTagClasses
(io.swagger.v3.oas.models.Operation operation) Is auto tag classes boolean.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setCachedOpenAPI
(io.swagger.v3.oas.models.OpenAPI cachedOpenAPI, Locale locale) Sets cached open api.void
setServerBaseUrl
(String serverBaseUrl) Sets server base url.void
setServersPresent
(boolean serversPresent) Sets servers present.static String
splitCamelCase
(String str) Split camel case string.void
updateServers
(io.swagger.v3.oas.models.OpenAPI openAPI) Update servers open api.
-
Constructor Details
-
OpenAPIService
public OpenAPIService(Optional<io.swagger.v3.oas.models.OpenAPI> openAPI, SecurityService securityParser, SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils, Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomizers, Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomizers, Optional<JavadocProvider> javadocProvider) Instantiates a new Open api builder.- Parameters:
openAPI
- the open apisecurityParser
- the security parserspringDocConfigProperties
- the spring doc config propertiespropertyResolverUtils
- the property resolver utilsopenApiBuilderCustomizers
- the open api builder customisersserverBaseUrlCustomizers
- the server base url customizersjavadocProvider
- the javadoc provider
-
-
Method Details
-
splitCamelCase
Split camel case string.- Parameters:
str
- the str- Returns:
- the string
-
build
Build.- Parameters:
locale
- the locale
-
updateServers
public void updateServers(io.swagger.v3.oas.models.OpenAPI openAPI) Update servers open api.- Parameters:
openAPI
- the open api
-
setServersPresent
public void setServersPresent(boolean serversPresent) Sets servers present.- Parameters:
serversPresent
- the servers present
-
buildTags
public io.swagger.v3.oas.models.Operation buildTags(org.springframework.web.method.HandlerMethod handlerMethod, io.swagger.v3.oas.models.Operation operation, io.swagger.v3.oas.models.OpenAPI openAPI, Locale locale) Build tags operation.- Parameters:
handlerMethod
- the handler methodoperation
- the operationopenAPI
- the open apilocale
- the locale- Returns:
- the operation
-
buildTagsFromClass
public void buildTagsFromClass(Class<?> beanType, Set<io.swagger.v3.oas.models.tags.Tag> tags, Set<String> tagsStr, Locale locale) Build tags from class.- Parameters:
beanType
- the bean typetags
- the tagstagsStr
- the tags strlocale
- the locale
-
isAutoTagClasses
public boolean isAutoTagClasses(io.swagger.v3.oas.models.Operation operation) Is auto tag classes boolean.- Parameters:
operation
- the operation- Returns:
- the boolean
-
addTag
public void addTag(Set<org.springframework.web.method.HandlerMethod> handlerMethods, io.swagger.v3.oas.models.tags.Tag tag) Add tag.- Parameters:
handlerMethods
- the handler methodstag
- the tag
-
getMappingsMap
Gets mappings map.- Returns:
- the mappings map
-
addMappings
Add mappings.- Parameters:
mappings
- the mappings
-
getControllerAdviceMap
Gets controller advice map.- Returns:
- the controller advice map
-
getCachedOpenAPI
Gets cached open api.- Parameters:
locale
- associated the the cache entry- Returns:
- the cached open api
-
setCachedOpenAPI
Sets cached open api.- Parameters:
cachedOpenAPI
- the cached open apilocale
- associated the the cache entry
-
getContext
public org.springframework.context.ApplicationContext getContext()Gets context.- Returns:
- the context
-
getSecurityParser
Gets security parser.- Returns:
- the security parser
-
getServerBaseUrl
Gets server base URL- Returns:
- the server base URL
-
setServerBaseUrl
Sets server base url.- Parameters:
serverBaseUrl
- the server base url
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-