OpenAPI tooling

OpenAPI overview

Export your contract to OpenAPI or generate a contract from an existing document.

On this page

@hulla/api-openapi converts between a contract and an OpenAPI document. Export a document to share your API, or import one to call an API described by someone else.

WorkflowStarting pointResultUse it whenFocused guide
Export a contractAn @hulla/api runtime contract and documentation sidecarAn OpenAPI 3.1.2 or 3.2.0 JSON or YAML documentThe TypeScript contract owns the API and external consumers need a standard wire descriptionExport a contract to OpenAPI
Import an OpenAPI documentAn existing provider-owned OpenAPI documentA normal @hulla/api runtime contract and typed sidecarAn external specification owns the API and the application needs typed calls or a checked-in contractImport OpenAPI into a contract

The runtime contract describes what @hulla/api executes: routes, request representations, responses, and errors.

The documentation sidecar describes how that contract appears in OpenAPI: titles, summaries, descriptions, tags, examples, security metadata, and schema overrides. Generation reads the sidecar; clients, server implementations, and runtime requests do not.

The two workflows cross the boundary in opposite directions:

  1. A code-first contract plus its sidecar produces an OpenAPI document.
  2. An OpenAPI document produces a wire-oriented runtime contract plus a typed sidecar.
  3. The generated contract uses the same clients, transports, and server APIs as a hand-written contract.

Choose one source of truth. Export from a code-first contract or import from a provider-owned OpenAPI document; do not round-trip generated files as a synchronization strategy. OpenAPI cannot reconstruct application-side codecs or behavior that its schema does not represent.

@hulla/api-openapi reads and generates API descriptions. It does not:

  • serve an OpenAPI document;
  • install or configure Swagger UI, Scalar, Redoc, or another documentation interface;
  • implement authentication or authorization;
  • deploy the API or its documentation;
  • create a separate generated client runtime.

Use the host application or deployment platform for serving, UI, authentication, and deployment policy. OpenAPI security fields describe a policy; they do not enforce it.