Class OpenApiService

java.lang.Object
io.helidon.nima.openapi.OpenApiService
All Implemented Interfaces:
HttpService, ServerLifecycle, Supplier<HttpService>

public class OpenApiService extends Object implements HttpService
Provides an endpoint and supporting logic for returning an OpenAPI document that describes the endpoints handled by the server.

The server can use the OpenApiService.Builder to set OpenAPI-related attributes. If the server uses none of these builder methods and does not provide a static openapi file, then the /openapi endpoint responds with a nearly-empty OpenAPI document.

  • Field Details

    • DEFAULT_WEB_CONTEXT

      public static final String DEFAULT_WEB_CONTEXT
      Default path for serving the OpenAPI document.
      See Also:
    • DEFAULT_RESPONSE_MEDIA_TYPE

      public static final MediaType DEFAULT_RESPONSE_MEDIA_TYPE
      Default media type used in responses in absence of incoming Accept header.
  • Constructor Details

    • OpenApiService

      protected OpenApiService(OpenApiService.AbstractBuilder<?,?> builder)
      Creates a new instance of OpenAPISupport.
      Parameters:
      builder - the builder to use in constructing the instance
  • Method Details

    • builder

      public static OpenApiService.Builder builder()
      Creates a new OpenApiService.Builder for OpenAPISupport using defaults.
      Returns:
      new Builder
    • create

      public static OpenApiService create()
      Creates a new OpenApiService instance using defaults.
      Returns:
      new OpenAPISUpport
    • create

      public static OpenApiService create(Config config)
      Creates a new OpenApiService instance using the 'openapi' portion of the provided Config object.
      Parameters:
      config - Config object containing OpenAPI-related settings
      Returns:
      new OpenAPISupport instance created using the helidonConfig settings
    • routing

      public void routing(HttpRules rules)
      Description copied from interface: HttpService
      Updates the routing to add handlers of this service.
      Specified by:
      routing in interface HttpService
      Parameters:
      rules - to update
    • configureEndpoint

      public void configureEndpoint(HttpRules rules)
      Sets up the OpenAPI endpoint by adding routing to the specified rules set.
      Parameters:
      rules - routing rules to be augmented with OpenAPI endpoint
    • prepareModel

      protected void prepareModel()
      Triggers preparation of the model from external code.