OpenAPI
The functions, options and command of @dotpress/openapi. For a guide, see OpenAPI and API docs.
openapiPlugin()
Serves the document of the app, and an API reference page (Scalar). Unknown options are rejected.
docs.getDocument() returns the document, once the app is created. The warnings of the generation (a scheme used but not declared, a schema without JSON representation) are logged by the plugin.
generateOpenApi()
Returns the document of an app, or of a list of RouteInfo (app.routes). It takes the options of the plugin, except path, ui and middlewares, plus onWarning(message) (console.warn by default).
dotpress-openapi
With openapiPlugin() in the app, its document is used as is. The command exits with a non-zero code on failure.
Types
OpenApiDocument and the types of its objects (InfoObject, OperationObject, JsonSchema…) describe the subset of OpenAPI 3.1 that Dotpress writes. They may gain optional fields in minor versions. OpenApiSource is what generateOpenApi() accepts: an app, or a list of RouteInfo.