Class OpenApiViewConfig

java.lang.Object
io.micronaut.openapi.view.OpenApiViewConfig

public final class OpenApiViewConfig extends Object
OpenApi view configuration for Swagger UI, ReDoc, OpenAPI Explorer and RapiDoc. By default, no views are enabled.
Author:
croudet
See Also:
  • Field Details

  • 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

      public void setServerContextPath(String contextPath)
      Sets the server context path.
      Parameters:
      contextPath - The server context path.
    • getTitle

      public String getTitle()
      Returns the title for the generated views.
      Returns:
      A title.
    • setTitle

      public void setTitle(String title)
      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

      public void setSpecFile(String specFile)
      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()