Class OpenApiResource

    • Field Detail

      • requestMappingHandlerMapping

        protected final org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping requestMappingHandlerMapping
        The Request mapping handler mapping.
    • Constructor Detail

      • OpenApiResource

        public OpenApiResource​(String groupName,
                               org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory,
                               AbstractRequestService requestBuilder,
                               GenericResponseService responseBuilder,
                               OperationService operationParser,
                               org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping requestMappingHandlerMapping,
                               Optional<ActuatorProvider> actuatorProvider,
                               Optional<List<OperationCustomizer>> operationCustomizers,
                               Optional<List<OpenApiCustomiser>> openApiCustomisers,
                               SpringDocConfigProperties springDocConfigProperties,
                               Optional<SecurityOAuth2Provider> springSecurityOAuth2Provider,
                               Optional<RouterFunctionProvider> routerFunctionProvider,
                               Optional<RepositoryRestResourceProvider> repositoryRestResourceProvider)
        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
        requestMappingHandlerMapping - the request mapping handler mapping
        actuatorProvider - the actuator provider
        operationCustomizers - the operation customizers
        openApiCustomisers - the open api customisers
        springDocConfigProperties - the spring doc config properties
        springSecurityOAuth2Provider - the spring security o auth 2 provider
        routerFunctionProvider - the router function provider
        repositoryRestResourceProvider - the repository rest resource provider
      • OpenApiResource

        public OpenApiResource​(org.springframework.beans.factory.ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory,
                               AbstractRequestService requestBuilder,
                               GenericResponseService responseBuilder,
                               OperationService operationParser,
                               org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping requestMappingHandlerMapping,
                               Optional<ActuatorProvider> actuatorProvider,
                               Optional<List<OperationCustomizer>> operationCustomizers,
                               Optional<List<OpenApiCustomiser>> openApiCustomisers,
                               SpringDocConfigProperties springDocConfigProperties,
                               Optional<SecurityOAuth2Provider> springSecurityOAuth2Provider,
                               Optional<RouterFunctionProvider> routerFunctionProvider,
                               Optional<RepositoryRestResourceProvider> repositoryRestResourceProvider)
        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
        requestMappingHandlerMapping - the request mapping handler mapping
        actuatorProvider - the actuator provider
        operationCustomizers - the operation customizers
        openApiCustomisers - the open api customisers
        springDocConfigProperties - the spring doc config properties
        springSecurityOAuth2Provider - the spring security o auth 2 provider
        routerFunctionProvider - the router function provider
        repositoryRestResourceProvider - the repository rest resource provider
    • Method Detail

      • openapiJson

        public String openapiJson​(javax.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 String openapiYaml​(javax.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
      • 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 controllers
        map - the map
        locale - the locale
      • getActivePatterns

        public static Set<String> getActivePatterns​(org.springframework.web.servlet.mvc.method.RequestMappingInfo requestMappingInfo)
        Gets active patterns.
        Parameters:
        requestMappingInfo - the request mapping info
        Returns:
        the active patterns
      • calculateServerUrl

        protected void calculateServerUrl​(javax.servlet.http.HttpServletRequest request,
                                          String apiDocsUrl)
        Calculate server url.
        Parameters:
        request - the request
        apiDocsUrl - the api docs url
      • getServerUrl

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