Class SpincastOpenApiManagerDefault<R extends RequestContext<?>,W extends WebsocketContext<?>>

java.lang.Object
org.spincast.plugins.openapi.bottomup.SpincastOpenApiManagerDefault<R,W>
All Implemented Interfaces:
SpincastOpenApiManager

public class SpincastOpenApiManagerDefault<R extends RequestContext<?>,W extends WebsocketContext<?>> extends Object implements SpincastOpenApiManager
  • Field Details

    • logger

      protected static final org.slf4j.Logger logger
  • Constructor Details

  • Method Details

    • getRouter

      protected Router<R,W> getRouter()
    • getJsonManager

      protected JsonManager getJsonManager()
    • getSpincastOpenApiBottomUpPluginConfig

      protected SpincastOpenApiBottomUpPluginConfig getSpincastOpenApiBottomUpPluginConfig()
    • getAnnotationsCreator

      protected SwaggerAnnotationsCreator getAnnotationsCreator()
    • getDefaultRouteParamAliasesBinder

      protected DefaultRouteParamAliasesBinder<R,W> getDefaultRouteParamAliasesBinder()
    • getRouteIdsToHide

      public Set<String> getRouteIdsToHide()
    • getRouteHttpMethodAndPathToHide

      public Set<String> getRouteHttpMethodAndPathToHide()
    • clearCache

      public void clearCache()
      Delete cache so the Open API object is computed from scratch.
      Specified by:
      clearCache in interface SpincastOpenApiManager
    • resetAll

      public void resetAll()
      Description copied from interface: SpincastOpenApiManager
      Reset everything : delete caches, delete ignored routes, etc.
      Specified by:
      resetAll in interface SpincastOpenApiManager
    • setOpenApiBase

      public void setOpenApiBase(io.swagger.v3.oas.models.OpenAPI baseOpenApiInfo)
      Description copied from interface: SpincastOpenApiManager
      The base OpenAPI informations for the generated specs file.

      This can be a full and standalone OpenAPI object, containing your paths, models, etc. Or it can be the base information to which specs specific to each routes will be added.

      Specified by:
      setOpenApiBase in interface SpincastOpenApiManager
    • getBaseOpenApiInfo

      public io.swagger.v3.oas.models.OpenAPI getBaseOpenApiInfo()
    • getOpenApi

      public io.swagger.v3.oas.models.OpenAPI getOpenApi()
      Description copied from interface: SpincastOpenApiManager
      The generated specifications as a OpenAPI object.
      Specified by:
      getOpenApi in interface SpincastOpenApiManager
      Parameters:
      force - If true, cache will be bypassed on updated.
    • createScanner

      protected io.swagger.v3.oas.integration.api.OpenApiScanner createScanner(Set<Class<?>> classes)
    • generateJaxRsLikeClasses

      protected Set<Class<?>> generateJaxRsLikeClasses()
      This method will dynamically create and annotate classes to simulate a JAX-RS application. This way, we can reuse the logic from swagger-jaxrs2 to generate the OpenAPI object.
    • isSupportedHttpMethod

      protected boolean isSupportedHttpMethod(HttpMethod httpMethod)
    • getPathsFromYamlString

      protected io.swagger.v3.oas.models.Paths getPathsFromYamlString(String routePath, String specs)
    • getOpenApiPrefix

      protected String getOpenApiPrefix()
    • isToHideFromId

      protected boolean isToHideFromId(Route<R> route)
    • isToHideFromHttpMethodAndPath

      protected boolean isToHideFromHttpMethodAndPath(Route<R> route, HttpMethod httpMethod)
    • createOperationId

      protected String createOperationId(Route<R> route, HttpMethod httpMethod)
    • addHttpMethodAnnotation

      protected void addHttpMethodAnnotation(List<Annotation> handlerMethodAnnotations, HttpMethod httpMethod)
    • getHttpMethodAnnotation

      protected Annotation getHttpMethodAnnotation(HttpMethod httpMethod)
    • addPathAnnotationToHandlerMethod

      protected void addPathAnnotationToHandlerMethod(List<Annotation> handlerMethodAannotations, String routePath)
    • convertSpincastRoutePathToOpenApiFormat

      protected String convertSpincastRoutePathToOpenApiFormat(String spincastRoutePath)
      Convert dynamic path parameters to Open API format.

      /${param1}/${param3:\\d+}/${param4:<A>}

      =>

      /{param1}/{param2}/{param3}

    • getSpecsAnnotation

      protected Specs getSpecsAnnotation(Object specsObj)
    • addOperationAnnotationToHandlerMethod

      protected void addOperationAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs)
    • addParametersAnnotationToHandlerMethod

      protected void addParametersAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, String routePath, Specs specs)
    • createParamDescriptionFromAlias

      protected String createParamDescriptionFromAlias(String alias)
    • createParamPatternFromAlias

      protected String createParamPatternFromAlias(String alias)
    • isOperationAnnotationContainsParameter

      protected boolean isOperationAnnotationContainsParameter(io.swagger.v3.oas.annotations.Operation operationAnnotation, String paramName)
    • addConsumesAnnotationToHandlerMethod

      protected void addConsumesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs, Route<R> route)
    • addProducesAnnotationToHandlerMethod

      protected void addProducesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs)
    • getOpenApiAsJson

      public String getOpenApiAsJson()
      Description copied from interface: SpincastOpenApiManager
      The generated specifications as pretty formatted JSON.
      Specified by:
      getOpenApiAsJson in interface SpincastOpenApiManager
    • getOpenApiAsJson

      public String getOpenApiAsJson(boolean prettyFormatted)
      Description copied from interface: SpincastOpenApiManager
      The generated specifications as JSON.
      Specified by:
      getOpenApiAsJson in interface SpincastOpenApiManager
    • getOpenApiAsYaml

      public String getOpenApiAsYaml()
      Description copied from interface: SpincastOpenApiManager
      The generated specifications as pretty formatted YAML.
      Specified by:
      getOpenApiAsYaml in interface SpincastOpenApiManager
    • getOpenApiAsYaml

      public String getOpenApiAsYaml(boolean prettyFormatted)
      Description copied from interface: SpincastOpenApiManager
      The generated specifications as YAML.
      Specified by:
      getOpenApiAsYaml in interface SpincastOpenApiManager
    • ignoreRoutesByIds

      public void ignoreRoutesByIds(String... ids)
      Description copied from interface: SpincastOpenApiManager
      Ignore routes using their ids.
      Specified by:
      ignoreRoutesByIds in interface SpincastOpenApiManager
    • createHttpMethodAndPathKey

      protected String createHttpMethodAndPathKey(HttpMethod method, String path)
    • ignoreRouteUsingHttpMethodAndPath

      public void ignoreRouteUsingHttpMethodAndPath(HttpMethod method, String path)
      Description copied from interface: SpincastOpenApiManager
      Ignore a route using its HTTP method and path.
      Specified by:
      ignoreRouteUsingHttpMethodAndPath in interface SpincastOpenApiManager
      Parameters:
      method - If null, all HTTP methods will be used.
    • addYamlStringSpecifiedPaths

      protected void addYamlStringSpecifiedPaths(io.swagger.v3.oas.models.OpenAPI openApi)
    • convertHttpMethodToSpincast

      protected HttpMethod convertHttpMethodToSpincast(io.swagger.v3.oas.models.PathItem.HttpMethod httpMethod)