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

    Constructors
    Constructor
    Description
    OpenApiWebMvcResource(String groupName, org.springframework.beans.factory.ObjectFactory<org.springdoc.core.service.OpenAPIService> openAPIBuilderObjectFactory, org.springdoc.core.service.AbstractRequestService requestBuilder, org.springdoc.core.service.GenericResponseService responseBuilder, org.springdoc.core.service.OperationService operationParser, org.springdoc.core.properties.SpringDocConfigProperties springDocConfigProperties, org.springdoc.core.providers.SpringDocProviders springDocProviders, org.springdoc.core.customizers.SpringDocCustomizers springDocCustomizers)
    Instantiates a new Open api web mvc resource.
    OpenApiWebMvcResource(org.springframework.beans.factory.ObjectFactory<org.springdoc.core.service.OpenAPIService> openAPIBuilderObjectFactory, org.springdoc.core.service.AbstractRequestService requestBuilder, org.springdoc.core.service.GenericResponseService responseBuilder, org.springdoc.core.service.OperationService operationParser, org.springdoc.core.properties.SpringDocConfigProperties springDocConfigProperties, org.springdoc.core.providers.SpringDocProviders springDocProviders, org.springdoc.core.customizers.SpringDocCustomizers springDocCustomizers)
    Instantiates a new Open api web mvc resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    getServerUrl(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, getPaths

    Methods inherited from class org.springdoc.api.AbstractOpenApiResource

    addHiddenRestControllers, addHiddenRestControllers, addRestControllers, calculatePath, calculatePath, calculatePath, calculatePath, calculateWebhooks, containsResponseBody, customizeOperation, customizeRouterOperation, decode, getActuatorURI, getDefaultAllowedHttpMethods, getOpenApi, getOpenApi, getRouterFunctionPaths, initOpenAPIBuilder, isActuatorRestController, isAdditionalRestController, isConditionToMatch, isFilterCondition, isHiddenRestControllers, isMethodToFilter, isPackageToScan, isPathToMatch, isRestController, mergeRouters, setModelAndViewClass, writeJsonValue, writeYamlValue

    Methods inherited from class io.swagger.v3.core.filter.SpecFilter

    filter, filterComponentsSchema, filterOpenAPI, filterOperation, filterParameter, filterPathItem, filterRequestBody, filterResponse, locateReferencedDefinitions, removeBrokenReferenceDefinitions, resolveAllNestedRefs

    Methods inherited from class java.lang.Object

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

    • OpenApiWebMvcResource

      public OpenApiWebMvcResource(String groupName, org.springframework.beans.factory.ObjectFactory<org.springdoc.core.service.OpenAPIService> openAPIBuilderObjectFactory, org.springdoc.core.service.AbstractRequestService requestBuilder, org.springdoc.core.service.GenericResponseService responseBuilder, org.springdoc.core.service.OperationService operationParser, org.springdoc.core.properties.SpringDocConfigProperties springDocConfigProperties, org.springdoc.core.providers.SpringDocProviders springDocProviders, org.springdoc.core.customizers.SpringDocCustomizers springDocCustomizers)
      Instantiates a new Open api web mvc resource.
      Parameters:
      groupName - the group name
      openAPIBuilderObjectFactory - the open api builder object factory
      requestBuilder - the request builder
      responseBuilder - the response builder
      operationParser - the operation parser
      springDocConfigProperties - the spring doc config properties
      springDocProviders - the spring doc providers
      springDocCustomizers - the spring doc customizers
    • OpenApiWebMvcResource

      @Autowired public OpenApiWebMvcResource(org.springframework.beans.factory.ObjectFactory<org.springdoc.core.service.OpenAPIService> openAPIBuilderObjectFactory, org.springdoc.core.service.AbstractRequestService requestBuilder, org.springdoc.core.service.GenericResponseService responseBuilder, org.springdoc.core.service.OperationService operationParser, org.springdoc.core.properties.SpringDocConfigProperties springDocConfigProperties, org.springdoc.core.providers.SpringDocProviders springDocProviders, org.springdoc.core.customizers.SpringDocCustomizers springDocCustomizers)
      Instantiates a new Open api web mvc resource.
      Parameters:
      openAPIBuilderObjectFactory - the open api builder object factory
      requestBuilder - the request builder
      responseBuilder - the response builder
      operationParser - the operation parser
      springDocConfigProperties - the spring doc config properties
      springDocProviders - the spring doc providers
      springDocCustomizers - 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:
      openapiJson in class OpenApiResource
      Parameters:
      request - the request
      apiDocsUrl - the api docs url
      locale - 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:
      openapiYaml in class OpenApiResource
      Parameters:
      request - the request
      apiDocsUrl - the api docs url
      locale - the locale
      Returns:
      the string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - the json processing exception
    • getServerUrl

      protected String getServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl)
      Gets server url.
      Specified by:
      getServerUrl in class OpenApiResource
      Parameters:
      request - the request
      apiDocsUrl - the api docs url
      Returns:
      the server url