Package org.springdoc.webmvc.api
Class OpenApiWebMvcResource
java.lang.Object
io.swagger.v3.core.filter.SpecFilter
org.springdoc.api.AbstractOpenApiResource
org.springdoc.webmvc.api.OpenApiResource
org.springdoc.webmvc.api.OpenApiWebMvcResource
@RestController
@ConditionalOnProperty(name="springdoc.enable-default-api-docs",
havingValue="true",
matchIfMissing=true)
public class OpenApiWebMvcResource
extends OpenApiResource
The type Open api resource.
- Author:
- bnasslahsen
-
Field Summary
Fields inherited from class org.springdoc.api.AbstractOpenApiResource
groupName, openAPIService, springDocConfigProperties, springDocCustomizers, springDocProviders -
Constructor Summary
ConstructorsConstructorDescriptionOpenApiWebMvcResource(String groupName, org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders, SpringDocCustomizers springDocCustomizers) Instantiates a new Open api web mvc resource.OpenApiWebMvcResource(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders, SpringDocCustomizers springDocCustomizers) Instantiates a new Open api web mvc resource. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl) Gets server url.byte[]openapiJson(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Openapi json string.byte[]openapiYaml(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) Openapi yaml string.Methods inherited from class org.springdoc.webmvc.api.OpenApiResource
calculatePath, calculateServerUrl, getPathsMethods inherited from class org.springdoc.api.AbstractOpenApiResource
addHiddenRestControllers, addHiddenRestControllers, addRestControllers, calculatePath, calculatePath, calculatePath, calculatePath, calculateWebhooks, containsResponseBody, customizeOperation, customizeRouterOperation, decode, getActuatorURI, getDefaultAllowedHttpMethods, getOpenApi, getRouterFunctionPaths, initOpenAPIBuilder, isActuatorRestController, isAdditionalRestController, isConditionToMatch, isFilterCondition, isHiddenRestControllers, isMethodToFilter, isPackageToScan, isPathToMatch, isRestController, mergeRouters, setModelAndViewClass, writeJsonValue, writeYamlValueMethods inherited from class io.swagger.v3.core.filter.SpecFilter
filter, filterComponentsSchema, filterOpenAPI, filterOperation, filterParameter, filterPathItem, filterRequestBody, filterResponse, locateReferencedDefinitions, removeBrokenReferenceDefinitions, resolveAllNestedRefs
-
Constructor Details
-
OpenApiWebMvcResource
public OpenApiWebMvcResource(String groupName, org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders, SpringDocCustomizers springDocCustomizers) Instantiates a new Open api web mvc resource.- Parameters:
groupName- the group nameopenAPIBuilderObjectFactory- the open api builder object factoryrequestBuilder- the request builderresponseBuilder- the response builderoperationParser- the operation parserspringDocConfigProperties- the spring doc config propertiesspringDocProviders- the spring doc providersspringDocCustomizers- the spring doc customizers
-
OpenApiWebMvcResource
@Autowired public OpenApiWebMvcResource(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders, SpringDocCustomizers springDocCustomizers) Instantiates a new Open api web mvc resource.- Parameters:
openAPIBuilderObjectFactory- the open api builder object factoryrequestBuilder- the request builderresponseBuilder- the response builderoperationParser- the operation parserspringDocConfigProperties- the spring doc config propertiesspringDocProviders- the spring doc providersspringDocCustomizers- the spring doc customizers
-
-
Method Details
-
openapiJson
@GetMapping(value="${springdoc.api-docs.path:#{T(org.springdoc.core.utils.Constants).DEFAULT_API_DOCS_URL}}", produces="application/json") public byte[] openapiJson(jakarta.servlet.http.HttpServletRequest request, @Value("${springdoc.api-docs.path:#{T(org.springdoc.core.utils.Constants).DEFAULT_API_DOCS_URL}}") String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException Openapi json string.- Overrides:
openapiJsonin classOpenApiResource- Parameters:
request- the requestapiDocsUrl- the api docs urllocale- the locale- Returns:
- the string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- the json processing exception
-
openapiYaml
@GetMapping(value="${springdoc.api-docs.path:#{T(org.springdoc.core.utils.Constants).DEFAULT_API_DOCS_URL}}.yaml", produces="application/vnd.oai.openapi") public byte[] openapiYaml(jakarta.servlet.http.HttpServletRequest request, @Value("${springdoc.api-docs.path:#{T(org.springdoc.core.utils.Constants).DEFAULT_API_DOCS_URL}}.yaml") String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException Openapi yaml string.- Overrides:
openapiYamlin classOpenApiResource- Parameters:
request- the requestapiDocsUrl- the api docs urllocale- the locale- Returns:
- the string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- the json processing exception
-
getServerUrl
Gets server url.- Specified by:
getServerUrlin classOpenApiResource- Parameters:
request- the requestapiDocsUrl- the api docs url- Returns:
- the server url
-