Class OpenAPISupport.Builder<B extends OpenAPISupport.Builder<B>>

java.lang.Object
io.helidon.openapi.OpenAPISupport.Builder<B>
Type Parameters:
B - concrete subclass of OpenAPISupport.Builder
All Implemented Interfaces:
Builder<B,OpenAPISupport>, Supplier<OpenAPISupport>
Direct Known Subclasses:
MPOpenAPIBuilder, SEOpenAPISupportBuilder
Enclosing class:
OpenAPISupport

public abstract static class OpenAPISupport.Builder<B extends OpenAPISupport.Builder<B>> extends Object implements Builder<B,OpenAPISupport>
Fluent API builder for OpenAPISupport.

This abstract implementation is extended once for use by developers from Helidon SE apps and once for use from the Helidon MP-provided OpenAPI service. This lets us constrain what use cases are possible from each (for example, no anno processing from SE).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Config key to select the openapi node from Helidon config.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    config(Config config)
    Set various builder attributes from the specified Config object.
    Assigns the CORS settings for the OpenAPI endpoint.
    protected Supplier<List<? extends org.jboss.jandex.IndexView>>
    Returns the supplier of index views.
    abstract io.smallrye.openapi.api.OpenApiConfig
    Returns the smallrye OpenApiConfig instance describing the set-up that will govern the smallrye OpenAPI behavior.
    Sets the file system path of the static OpenAPI document file.
    ui(OpenApiUi.Builder<?,?> uiBuilder)
    Assigns the OpenAPI UI builder the OpenAPISupport service should use in preparing the UI.
    void
    Makes sure the set-up for OpenAPI is consistent, internally and with the current Helidon runtime environment (SE or MP).
    Sets the web context path for the OpenAPI endpoint.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.helidon.common.Builder

    build, get, identity, update
  • Field Details

    • CONFIG_KEY

      public static final String CONFIG_KEY
      Config key to select the openapi node from Helidon config.
      See Also:
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • config

      public B config(Config config)
      Set various builder attributes from the specified Config object.

      The Config object can specify web-context and static-file in addition to settings supported by OpenAPIConfigImpl.Builder.

      Parameters:
      config - the openapi Config object possibly containing settings
      Returns:
      updated builder instance
      Throws:
      NullPointerException - if the provided Config is null
    • openAPIConfig

      public abstract io.smallrye.openapi.api.OpenApiConfig openAPIConfig()
      Returns the smallrye OpenApiConfig instance describing the set-up that will govern the smallrye OpenAPI behavior.
      Returns:
      OpenApiConfig conveying how OpenAPI should behave
    • validate

      public void validate() throws IllegalStateException
      Makes sure the set-up for OpenAPI is consistent, internally and with the current Helidon runtime environment (SE or MP).
      Throws:
      IllegalStateException - if validation fails
    • webContext

      public B webContext(String path)
      Sets the web context path for the OpenAPI endpoint.
      Parameters:
      path - webContext to use, defaults to "/openapi"
      Returns:
      updated builder instance
    • staticFile

      public B staticFile(String path)
      Sets the file system path of the static OpenAPI document file. Default types are `json`, `yaml`, and `yml`.
      Parameters:
      path - non-null location of the static OpenAPI document file
      Returns:
      updated builder instance
    • crossOriginConfig

      public B crossOriginConfig(CrossOriginConfig crossOriginConfig)
      Assigns the CORS settings for the OpenAPI endpoint.
      Parameters:
      crossOriginConfig - CrossOriginConfig containing CORS set-up
      Returns:
      updated builder instance
    • ui

      public B ui(OpenApiUi.Builder<?,?> uiBuilder)
      Assigns the OpenAPI UI builder the OpenAPISupport service should use in preparing the UI.
      Parameters:
      uiBuilder - the OpenApiUi.Builder
      Returns:
      updated builder instance
    • indexViewsSupplier

      protected Supplier<List<? extends org.jboss.jandex.IndexView>> indexViewsSupplier()
      Returns the supplier of index views.
      Returns:
      index views supplier