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

public abstract class OpenApiResource extends AbstractOpenApiResource
The type Web mvc open api resource.
Author:
bnasslahsen, Azige
  • Constructor Details

    • OpenApiResource

      protected OpenApiResource(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 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
    • OpenApiResource

      protected OpenApiResource(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory, AbstractRequestService requestBuilder, GenericResponseService responseBuilder, OperationService operationParser, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders, SpringDocCustomizers springDocCustomizers)
      Instantiates a new Open api 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

      public byte[] openapiJson(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException
      Openapi json string.
      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

      public byte[] openapiYaml(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale) throws com.fasterxml.jackson.core.JsonProcessingException
      Openapi yaml string.
      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
    • getPaths

      protected void getPaths(Map<String,Object> restControllers, Locale locale, io.swagger.v3.oas.models.OpenAPI openAPI)
      Specified by:
      getPaths in class AbstractOpenApiResource
    • calculatePath

      protected void calculatePath(Map<String,Object> restControllers, Map<org.springframework.web.servlet.mvc.method.RequestMappingInfo,org.springframework.web.method.HandlerMethod> map, Locale locale, io.swagger.v3.oas.models.OpenAPI openAPI)
      Calculate path.
      Parameters:
      restControllers - the rest controllers
      map - the map
      locale - the locale
      openAPI - the open api
    • calculateServerUrl

      protected String calculateServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl, Locale locale)
      Calculate server url.
      Parameters:
      request - the request
      apiDocsUrl - the api docs url
      locale - the locale
      Returns:
      the string
    • getServerUrl

      protected abstract String getServerUrl(jakarta.servlet.http.HttpServletRequest request, String apiDocsUrl)
      Gets server url.
      Parameters:
      request - the request
      apiDocsUrl - the api docs url
      Returns:
      the server url