Class OpenApiViewConfig


  • public final class OpenApiViewConfig
    extends java.lang.Object
    OpenApi view configuration for Swagger-ui, ReDoc and RapiDoc. By default, no views are enabled.
    See Also:
    Swagger-ui, ReDoc, RapiDoc
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static OpenApiViewConfig fromSpecification​(java.lang.String specification, java.util.Properties openApiProperties)
      Creates an OpenApiViewConfig form a String representation.
      java.lang.String getSpecURL​(io.micronaut.inject.visitor.VisitorContext context)
      Returns the relative openApi specification url path.
      java.lang.String getTitle()
      Returns the title for the generated views.
      boolean isEnabled()
      Returns true when the generation of views is enabled.
      void render​(java.nio.file.Path outputDir, io.micronaut.inject.visitor.VisitorContext visitorContext)
      Generates the views given this configuration.
      void setServerContextPath​(java.lang.String contextPath)
      Sets the server context path.
      void setSpecFile​(java.lang.String specFile)
      Sets the generated openApi specification file name.
      void setTitle​(java.lang.String title)
      Sets the title for the generated views.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromSpecification

        public static OpenApiViewConfig fromSpecification​(java.lang.String specification,
                                                          java.util.Properties openApiProperties)
        Creates an OpenApiViewConfig form a String representation.
        Parameters:
        specification - A String representation of an OpenApiViewConfig.
        openApiProperties - The open api properties.
        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​(java.nio.file.Path outputDir,
                           io.micronaut.inject.visitor.VisitorContext visitorContext)
                    throws java.io.IOException
        Generates the views given this configuration.
        Parameters:
        outputDir - The destination directory of the generated views.
        visitorContext - The visitor context
        Throws:
        java.io.IOException - When the generation fails.
      • setServerContextPath

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

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

        public void setTitle​(java.lang.String title)
        Sets the title for the generated views.
        Parameters:
        title - A title.
      • getSpecURL

        public java.lang.String getSpecURL​(io.micronaut.inject.visitor.VisitorContext context)
        Returns the relative openApi specification url path.
        Parameters:
        context - Visitor context.
        Returns:
        A path.
      • setSpecFile

        public void setSpecFile​(java.lang.String specFile)
        Sets the generated openApi specification file name.
        Parameters:
        specFile - The openApi specification file name.