public class SpincastOpenApiManagerDefault<R extends RequestContext<?>,W extends WebsocketContext<?>> extends Object implements SpincastOpenApiManager
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastOpenApiManagerDefault(Router<R,W> router,
JsonManager jsonManager,
SpincastOpenApiBottomUpPluginConfig spincastOpenApiBottomUpPluginConfig,
SwaggerAnnotationsCreator annotationsCreator,
DefaultRouteParamAliasesBinder<R,W> defaultRouteParamAliasesBinder) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConsumesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations,
Specs specs,
Route<R> route) |
protected void |
addHttpMethodAnnotation(List<Annotation> handlerMethodAnnotations,
HttpMethod httpMethod) |
protected void |
addOperationAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations,
Specs specs) |
protected void |
addParametersAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations,
String routePath,
Specs specs) |
protected void |
addPathAnnotationToHandlerMethod(List<Annotation> handlerMethodAannotations,
String routePath) |
protected void |
addProducesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations,
Specs specs) |
protected void |
addYamlStringSpecifiedPaths(io.swagger.v3.oas.models.OpenAPI openApi) |
void |
clearCache()
Delete cache so the Open API object
is computed from scratch.
|
protected HttpMethod |
convertHttpMethodToSpincast(io.swagger.v3.oas.models.PathItem.HttpMethod httpMethod) |
protected String |
convertSpincastRoutePathToOpenApiFormat(String spincastRoutePath)
Convert dynamic path parameters to Open API format.
|
protected String |
createHttpMethodAndPathKey(HttpMethod method,
String path) |
protected String |
createOperationId(Route<R> route,
HttpMethod httpMethod) |
protected String |
createParamDescriptionFromAlias(String alias) |
protected String |
createParamPatternFromAlias(String alias) |
protected io.swagger.v3.oas.integration.api.OpenApiScanner |
createScanner(Set<Class<?>> classes) |
protected Set<Class<?>> |
generateJaxRsLikeClasses()
This method will dynamically create and annotate
classes to simulate a JAX-RS application.
|
protected SwaggerAnnotationsCreator |
getAnnotationsCreator() |
io.swagger.v3.oas.models.OpenAPI |
getBaseOpenApiInfo() |
protected DefaultRouteParamAliasesBinder<R,W> |
getDefaultRouteParamAliasesBinder() |
protected Annotation |
getHttpMethodAnnotation(HttpMethod httpMethod) |
protected JsonManager |
getJsonManager() |
io.swagger.v3.oas.models.OpenAPI |
getOpenApi()
The generated specifications as a
OpenAPI object.
|
String |
getOpenApiAsJson()
The generated specifications as pretty
formatted JSON.
|
String |
getOpenApiAsJson(boolean prettyFormatted)
The generated specifications as JSON.
|
String |
getOpenApiAsYaml()
The generated specifications as pretty
formatted YAML.
|
String |
getOpenApiAsYaml(boolean prettyFormatted)
The generated specifications as YAML.
|
protected String |
getOpenApiPrefix() |
protected io.swagger.v3.oas.models.Paths |
getPathsFromYamlString(String routePath,
String specs) |
Set<String> |
getRouteHttpMethodAndPathToHide() |
Set<String> |
getRouteIdsToHide() |
protected Router<R,W> |
getRouter() |
protected Specs |
getSpecsAnnotation(Object specsObj) |
protected SpincastOpenApiBottomUpPluginConfig |
getSpincastOpenApiBottomUpPluginConfig() |
void |
ignoreRoutesByIds(String... ids)
Ignore routes using their ids.
|
void |
ignoreRouteUsingHttpMethodAndPath(HttpMethod method,
String path)
Ignore a route using its HTTP method and path.
|
protected boolean |
isOperationAnnotationContainsParameter(io.swagger.v3.oas.annotations.Operation operationAnnotation,
String paramName) |
protected boolean |
isSupportedHttpMethod(HttpMethod httpMethod) |
protected boolean |
isToHideFromHttpMethodAndPath(Route<R> route,
HttpMethod httpMethod) |
protected boolean |
isToHideFromId(Route<R> route) |
void |
resetAll()
Reset everything : delete caches, delete ignored routes, etc.
|
void |
setOpenApiBase(io.swagger.v3.oas.models.OpenAPI baseOpenApiInfo)
The base OpenAPI informations for the generated
specs file.
|
@Inject public SpincastOpenApiManagerDefault(Router<R,W> router, JsonManager jsonManager, SpincastOpenApiBottomUpPluginConfig spincastOpenApiBottomUpPluginConfig, SwaggerAnnotationsCreator annotationsCreator, DefaultRouteParamAliasesBinder<R,W> defaultRouteParamAliasesBinder)
protected JsonManager getJsonManager()
protected SpincastOpenApiBottomUpPluginConfig getSpincastOpenApiBottomUpPluginConfig()
protected SwaggerAnnotationsCreator getAnnotationsCreator()
protected DefaultRouteParamAliasesBinder<R,W> getDefaultRouteParamAliasesBinder()
public void clearCache()
clearCache in interface SpincastOpenApiManagerpublic void resetAll()
SpincastOpenApiManagerresetAll in interface SpincastOpenApiManagerpublic void setOpenApiBase(io.swagger.v3.oas.models.OpenAPI baseOpenApiInfo)
SpincastOpenApiManagerThis 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.
setOpenApiBase in interface SpincastOpenApiManagerpublic io.swagger.v3.oas.models.OpenAPI getBaseOpenApiInfo()
public io.swagger.v3.oas.models.OpenAPI getOpenApi()
SpincastOpenApiManagergetOpenApi in interface SpincastOpenApiManagerforce - If true, cache
will be bypassed on updated.protected io.swagger.v3.oas.integration.api.OpenApiScanner createScanner(Set<Class<?>> classes)
protected Set<Class<?>> generateJaxRsLikeClasses()
OpenAPI object.protected boolean isSupportedHttpMethod(HttpMethod httpMethod)
protected io.swagger.v3.oas.models.Paths getPathsFromYamlString(String routePath, String specs)
protected String getOpenApiPrefix()
protected boolean isToHideFromHttpMethodAndPath(Route<R> route, HttpMethod httpMethod)
protected String createOperationId(Route<R> route, HttpMethod httpMethod)
protected void addHttpMethodAnnotation(List<Annotation> handlerMethodAnnotations, HttpMethod httpMethod)
protected Annotation getHttpMethodAnnotation(HttpMethod httpMethod)
protected void addPathAnnotationToHandlerMethod(List<Annotation> handlerMethodAannotations, String routePath)
protected String convertSpincastRoutePathToOpenApiFormat(String spincastRoutePath)
/${param1}/${param3:\\d+}/${param4:<A>}
=>
/{param1}/{param2}/{param3}
protected void addOperationAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs)
protected void addParametersAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, String routePath, Specs specs)
protected boolean isOperationAnnotationContainsParameter(io.swagger.v3.oas.annotations.Operation operationAnnotation,
String paramName)
protected void addConsumesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs, Route<R> route)
protected void addProducesAnnotationToHandlerMethod(List<Annotation> handlerMethodAnnotations, Specs specs)
public String getOpenApiAsJson()
SpincastOpenApiManagergetOpenApiAsJson in interface SpincastOpenApiManagerpublic String getOpenApiAsJson(boolean prettyFormatted)
SpincastOpenApiManagergetOpenApiAsJson in interface SpincastOpenApiManagerpublic String getOpenApiAsYaml()
SpincastOpenApiManagergetOpenApiAsYaml in interface SpincastOpenApiManagerpublic String getOpenApiAsYaml(boolean prettyFormatted)
SpincastOpenApiManagergetOpenApiAsYaml in interface SpincastOpenApiManagerpublic void ignoreRoutesByIds(String... ids)
SpincastOpenApiManagerignoreRoutesByIds in interface SpincastOpenApiManagerprotected String createHttpMethodAndPathKey(HttpMethod method, String path)
public void ignoreRouteUsingHttpMethodAndPath(HttpMethod method, String path)
SpincastOpenApiManagerignoreRouteUsingHttpMethodAndPath in interface SpincastOpenApiManagermethod - If null, all
HTTP methods will be used.protected void addYamlStringSpecifiedPaths(io.swagger.v3.oas.models.OpenAPI openApi)
protected HttpMethod convertHttpMethodToSpincast(io.swagger.v3.oas.models.PathItem.HttpMethod httpMethod)
Copyright © 2019. All rights reserved.