Class Ui<S extends Ui<S>>

java.lang.Object
dev.relism.flash.ext.openapi.Ui<S>
Type Parameters:
S - the concrete UI, so every setter chains whatever the order
Direct Known Subclasses:
Ui.Redoc, Ui.Scalar, Ui.Swagger

public abstract class Ui<S extends Ui<S>> extends Object
The documentation page served beside the spec: Swagger UI, Redoc or Scalar. Each knows its own bundle and its own options; what they share — the page around it, the custom stylesheet, the escape hatch for an option this class does not name — lives here.

 new OpenApiExtension("/openapi", "My API", "1.0.0")
     .ui(Ui.scalar().theme(Ui.Scalar.Theme.PURPLE).layout(Ui.Scalar.Layout.CLASSIC).darkMode(true));
 

Options are the upstream ones, spelled as the upstream documents them, and land in the configuration object verbatim. The typed methods cover what is worth naming; anything else goes through option(String, Object), including whole nested objects (Redoc's theme).

The bundle comes from jsDelivr at a pinned version. cdn(String) points that elsewhere — a mirror, a proxy, or the files served by the application itself.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Redoc community edition, pinned to 2.x.
    static final class 
    Scalar's API reference, pinned to 1.x.
    static final class 
    Swagger UI, pinned to 5.x.
  • Method Summary

    Modifier and Type
    Method
    Description
    final S
    cdn(String cdn)
    Where the bundle is loaded from, without a trailing slash.
    final S
    CSS appended to the page, after the bundle's own.
    static Ui<?>
    No page at all — the spec routes stay.
    final S
    option(String name, Object value)
    Any option this class does not name, as its upstream documentation spells it; null drops it.
    static Ui.Redoc
    Redoc: three panels, read-only, the most printable of the three.
    static Ui.Scalar
    Scalar: the modern one, with themes and an API client built in.
    static Ui.Swagger
    Swagger UI: the one that lets you fire requests from the page.

    Methods inherited from class java.lang.Object

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

    • swagger

      public static Ui.Swagger swagger()
      Swagger UI: the one that lets you fire requests from the page.
    • redoc

      public static Ui.Redoc redoc()
      Redoc: three panels, read-only, the most printable of the three.
    • scalar

      public static Ui.Scalar scalar()
      Scalar: the modern one, with themes and an API client built in.
    • none

      public static Ui<?> none()
      No page at all — the spec routes stay. null is the absence of a UI, and this names it.
    • cdn

      public final S cdn(String cdn)
      Where the bundle is loaded from, without a trailing slash. Default: jsDelivr, at a pinned version.
    • customCss

      public final S customCss(String css)
      CSS appended to the page, after the bundle's own.
    • option

      public final S option(String name, Object value)
      Any option this class does not name, as its upstream documentation spells it; null drops it.