Class OpenApiRenderer

java.lang.Object
io.fluxzero.sdk.web.OpenApiRenderer

public final class OpenApiRenderer extends Object
Renders a generic ApiDocCatalog as an OpenAPI JSON document.

The renderer intentionally uses a small inline schema generator instead of binding the SDK API to an OpenAPI-specific model library. The generated schemas cover common Java primitives, enums, records, arrays, collections, maps, and simple field-based POJOs. Validation annotations on map values are retained. String-compatible map-key constraints are rendered as propertyNames in OpenAPI 3.1 and omitted in OpenAPI 3.0, where that keyword is unsupported. Required metadata on a body or body/form parameter also marks the OpenAPI Request Body Object as required.

See Also:
  • Method Details

    • render

      public static com.fasterxml.jackson.databind.node.ObjectNode render(ApiDocCatalog catalog)
      Renders the discovered API catalog as an OpenAPI JSON tree using catalog document information and renderer defaults.
    • render

      public static com.fasterxml.jackson.databind.node.ObjectNode render(ApiDocCatalog catalog, OpenApiOptions options)
      Renders the catalog's supported HTTP endpoints and schemas as an OpenAPI JSON tree, applying the supplied document options when present.
    • renderJson

      public static String renderJson(ApiDocCatalog catalog)
      Renders the catalog as compact OpenAPI JSON using catalog document information and renderer defaults.
    • renderJson

      public static String renderJson(ApiDocCatalog catalog, OpenApiOptions options)
      Renders the catalog as compact OpenAPI JSON with the supplied document options.
    • renderPrettyJson

      public static String renderPrettyJson(ApiDocCatalog catalog, OpenApiOptions options)
      Renders the catalog as formatted OpenAPI JSON with the supplied document options.