Package org.springdoc.webmvc.api
Class OpenApiResource
java.lang.Object
io.swagger.v3.core.filter.SpecFilter
org.springdoc.api.AbstractOpenApiResource
org.springdoc.webmvc.api.OpenApiResource
- Direct Known Subclasses:
OpenApiActuatorResource
,OpenApiWebMvcResource
The type Web mvc open api resource.
- Author:
- bnasslahsen, Azige
-
Field Summary
Fields inherited from class org.springdoc.api.AbstractOpenApiResource
groupName, openAPIService, springDocConfigProperties, springDocProviders
-
Constructor Summary
ConstructorsConstructorDescriptionOpenApiResource
(String groupName, org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, Optional<List<OperationCustomizer>> operationCustomizers, Optional<List<OpenApiCustomizer>> openApiCustomizers, Optional<List<OpenApiMethodFilter>> methodFilters, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders) Instantiates a new Open api resource.OpenApiResource
(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, Optional<List<OperationCustomizer>> operationCustomizers, Optional<List<OpenApiCustomizer>> openApiCustomizers, Optional<List<OpenApiMethodFilter>> methodFilters, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders) Instantiates a new Open api resource. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
calculatePath
(Map<String, Object> restControllers, Map<org.springframework.web.servlet.mvc.method.RequestMappingInfo, org.springframework.web.method.HandlerMethod> map, Locale locale) Calculate path.protected void
calculateServerUrl
(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Calculate server url.protected void
protected abstract String
getServerUrl
(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl) Gets server url.openapiJson
(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Openapi json string.openapiYaml
(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Openapi yaml string.Methods inherited from class org.springdoc.api.AbstractOpenApiResource
addHiddenRestControllers, addHiddenRestControllers, addRestControllers, calculatePath, calculatePath, calculatePath, calculatePath, containsResponseBody, customiseOperation, decode, getActuatorURI, getDefaultAllowedHttpMethods, getOpenApi, getRouterFunctionPaths, initOpenAPIBuilder, isActuatorRestController, isAdditionalRestController, isConditionToMatch, isFilterCondition, isHiddenRestControllers, isMethodToFilter, isPackageToScan, isPathToMatch, isRestController, mergeRouters, writeJsonValue, writeYamlValue
Methods inherited from class io.swagger.v3.core.filter.SpecFilter
filter, filterComponentsSchema, filterOpenAPI, filterOperation, filterParameter, filterPathItem, filterRequestBody, filterResponse, locateReferencedDefinitions, removeBrokenReferenceDefinitions, resolveAllNestedRefs
-
Constructor Details
-
OpenApiResource
public OpenApiResource(String groupName, org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, Optional<List<OperationCustomizer>> operationCustomizers, Optional<List<OpenApiCustomizer>> openApiCustomizers, Optional<List<OpenApiMethodFilter>> methodFilters, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders) Instantiates a new Open api resource.- Parameters:
groupName
- the group nameopenAPIBuilderObjectFactory
- the open api builder object factoryrequestBuilder
- the request builderresponseBuilder
- the response builderoperationParser
- the operation parseroperationCustomizers
- the operation customizersopenApiCustomizers
- the open api customisersmethodFilters
- the method filtersspringDocConfigProperties
- the spring doc config propertiesspringDocProviders
- the spring doc providers
-
OpenApiResource
public OpenApiResource(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, Optional<List<OperationCustomizer>> operationCustomizers, Optional<List<OpenApiCustomizer>> openApiCustomizers, Optional<List<OpenApiMethodFilter>> methodFilters, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders) Instantiates a new Open api resource.- Parameters:
openAPIBuilderObjectFactory
- the open api builder object factoryrequestBuilder
- the request builderresponseBuilder
- the response builderoperationParser
- the operation parseroperationCustomizers
- the operation customizersopenApiCustomizers
- the open api customisersmethodFilters
- the method filtersspringDocConfigProperties
- the spring doc config propertiesspringDocProviders
- the spring doc providers
-
-
Method Details
-
openapiJson
public String openapiJson(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException Openapi json string.- Parameters:
request
- the requestapiDocsUrl
- the api docs urllocale
- the locale- Returns:
- the string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
openapiYaml
public String openapiYaml(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException Openapi yaml string.- Parameters:
request
- the requestapiDocsUrl
- the api docs urllocale
- the locale- Returns:
- the string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
getPaths
- Specified by:
getPaths
in classAbstractOpenApiResource
-
calculatePath
protected void calculatePath(Map<String, Object> restControllers, Map<org.springframework.web.servlet.mvc.method.RequestMappingInfo, org.springframework.web.method.HandlerMethod> map, Locale locale) Calculate path.- Parameters:
restControllers
- the rest controllersmap
- the maplocale
- the locale
-
calculateServerUrl
protected void calculateServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Calculate server url.- Parameters:
request
- the requestapiDocsUrl
- the api docs url
-
getServerUrl
protected abstract String getServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl) Gets server url.- Parameters:
request
- the requestapiDocsUrl
- the api docs url- Returns:
- the server url
-