Module io.jooby
Package io.jooby

Class OpenAPIModule

java.lang.Object
io.jooby.OpenAPIModule
All Implemented Interfaces:
Extension

public class OpenAPIModule extends Object implements Extension
OpenAPI supports for Jooby. Basic Usage:

 {
   install(new OpenAPIModule());
 }
 
The [openapi].json and/or [openapi].yaml files must be present on classpath.

If jooby-swagger-ui is present (part of your project classpath) swagger-ui will be available. Same for jooby-redoc.

Complete documentation is available at: https://jooby.io/modules/openapi

Since:
2.7.0
Author:
edgar
  • Constructor Details

    • OpenAPIModule

      public OpenAPIModule(@NonNull String path)
      Creates an OpenAPI module. The path is used to route the open API files. For example:
      
       install(new OpenAPIModule("/docs"));
       
      Files will be at /docs/openapi.json, /docs/openapi.yaml.
      Parameters:
      path - Custom path to use.
    • OpenAPIModule

      public OpenAPIModule()
      Creates an OpenAPI module.

      Files will be at /openapi.json, /openapi.yaml.

  • Method Details

    • swaggerUI

      @NonNull public OpenAPIModule swaggerUI(@NonNull String path)
      Customize the swagger-ui path. Defaults is /swagger.
      Parameters:
      path - Swagger-ui path.
      Returns:
      This module.
    • redoc

      @NonNull public OpenAPIModule redoc(@NonNull String path)
      Customize the redoc-ui path. Defaults is /redoc.
      Parameters:
      path - Redoc path.
      Returns:
      This module.
    • format

      @NonNull public OpenAPIModule format(@NonNull OpenAPIModule.Format... format)
      Enable what format are available (json or yaml).

      IMPORTANT: UI tools requires the JSON format.

      Parameters:
      format - Supported formats.
      Returns:
      This module.
    • install

      public void install(@NonNull Jooby application) throws Exception
      Description copied from interface: Extension
      Install, configure additional features to a Jooby application.
      Specified by:
      install in interface Extension
      Parameters:
      application - Jooby application.
      Throws:
      Exception - If something goes wrong.