Package io.micronaut.openapi.view
Class OpenApiViewConfig
java.lang.Object
io.micronaut.openapi.view.OpenApiViewConfig
OpenApi view configuration for Swagger UI, ReDoc, OpenAPI Explorer and RapiDoc.
By default, no views are enabled.
- Author:
- croudet
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic OpenApiViewConfig
fromSpecification
(String specification, Map<Pair<String, String>, OpenApiInfo> openApiInfos, Properties openApiProperties, io.micronaut.inject.visitor.VisitorContext context) Creates an OpenApiViewConfig form a String representation.io.micronaut.openapi.view.OpenApiExplorerConfig
io.micronaut.openapi.view.RapidocConfig
io.micronaut.openapi.view.RedocConfig
getSpecURL
(io.micronaut.openapi.view.AbstractViewConfig cfg, @Nullable io.micronaut.inject.visitor.VisitorContext context) Returns the relative openApi specification url path.io.micronaut.openapi.view.SwaggerUIConfig
getTitle()
Returns the title for the generated views.boolean
Returns true when the generation of views is enabled.void
Generates the views given this configuration.void
setServerContextPath
(String contextPath) Sets the server context path.void
setSpecFile
(String specFile) Sets the generated openApi specification file name.void
Sets the title for the generated views.
-
Field Details
-
DEFAULT_SPEC_MAPPING_PATH
- See Also:
-
RESOURCE_DIR
- See Also:
-
THEMES_DIR
- See Also:
-
TEMPLATES
- See Also:
-
TEMPLATES_RAPIPDF
- See Also:
-
TEMPLATES_SWAGGER_UI
- See Also:
-
TEMPLATES_REDOC
- See Also:
-
TEMPLATES_RAPIDOC
- See Also:
-
TEMPLATES_OPENAPI_EXPLORER
- See Also:
-
-
Method Details
-
fromSpecification
public static OpenApiViewConfig fromSpecification(String specification, Map<Pair<String, String>, OpenApiInfo> openApiInfos, Properties openApiProperties, io.micronaut.inject.visitor.VisitorContext context) Creates an OpenApiViewConfig form a String representation.- Parameters:
specification
- A String representation of an OpenApiViewConfig.openApiInfos
- Open API info objects.openApiProperties
- The open api properties.context
- Visitor context.- Returns:
- An OpenApiViewConfig.
-
isEnabled
public boolean isEnabled()Returns true when the generation of views is enabled.- Returns:
- true when the generation of views is enabled.
-
render
public void render(Path outputDir, io.micronaut.inject.visitor.VisitorContext context) throws IOException Generates the views given this configuration.- Parameters:
outputDir
- The destination directory of the generated views.context
- The visitor context- Throws:
IOException
- When the generation fails.
-
setServerContextPath
Sets the server context path.- Parameters:
contextPath
- The server context path.
-
getTitle
Returns the title for the generated views.- Returns:
- A title.
-
setTitle
Sets the title for the generated views.- Parameters:
title
- A title.
-
getSpecURL
public String getSpecURL(io.micronaut.openapi.view.AbstractViewConfig cfg, @Nullable @Nullable io.micronaut.inject.visitor.VisitorContext context) Returns the relative openApi specification url path.- Parameters:
cfg
- view config.context
- Visitor context.- Returns:
- A path.
-
setSpecFile
Sets the generated openApi specification file name.- Parameters:
specFile
- The openApi specification file name.
-
getSwaggerUIConfig
public io.micronaut.openapi.view.SwaggerUIConfig getSwaggerUIConfig() -
getRedocConfig
public io.micronaut.openapi.view.RedocConfig getRedocConfig() -
getRapidocConfig
public io.micronaut.openapi.view.RapidocConfig getRapidocConfig() -
getOpenApiExplorerConfig
public io.micronaut.openapi.view.OpenApiExplorerConfig getOpenApiExplorerConfig()
-