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:
-
Nested Class Summary
-
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
(AbstractViewConfig cfg, @Nullable 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
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.
-
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(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
-
getRedocConfig
-
getRapidocConfig
-
getOpenApiExplorerConfig
-