Package io.micronaut.openapi.view
Class OpenApiViewConfig
java.lang.Object
io.micronaut.openapi.view.OpenApiViewConfig
OpenApi view configuration for Swagger-ui, ReDoc 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.getSpecURL
(io.micronaut.openapi.view.AbstractViewConfig cfg, io.micronaut.inject.visitor.VisitorContext context) Returns the relative openApi specification url path.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
-
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:
-
SLASH
- 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, 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.
-