Skip to main content

@rtorcato/api-openapi-hono v1.0.0

Interfaces

ConfigureOpenAPIOptions

Defined in: index.ts:16

Properties

document

document: OpenAPIDocument

Defined in: index.ts:18

OpenAPI document metadata. info (title + version) is required; add servers, security, tags, … as needed.

docPath?

optional docPath?: string

Defined in: index.ts:20

Path that serves the generated OpenAPI 3.1 JSON. Default: /doc.

referencePath?

optional referencePath?: string

Defined in: index.ts:22

Path that serves the Scalar API reference UI. Default: /reference.

scalar?

optional scalar?: Partial<HtmlRenderingConfiguration>

Defined in: index.ts:24

Scalar UI overrides merged over the defaults (theme, layout, pageTitle, …).

Type Aliases

OpenAPIDocument

OpenAPIDocument = Omit<FullOpenAPIDocument, "openapi"> & object

Defined in: index.ts:14

OpenAPI document metadata: info (title + version) is required, plus optional servers, security, tags, etc. openapi defaults to 3.1.0 — override it only to pin another version.

Type Declaration

openapi?

optional openapi?: string

Functions

configureOpenAPI()

configureOpenAPI<A>(app, options): A

Defined in: index.ts:47

Wire schema-first OpenAPI docs onto an OpenAPIHono app.

Serves the generated OpenAPI 3.1 document at docPath and the Scalar reference UI at referencePath. The spec derives from the app's createRoute Zod schemas, so the docs can't drift from the validation.

Type Parameters

A

A extends OpenAPIHono<any, any, any>

Parameters

app

A

options

ConfigureOpenAPIOptions

Returns

A

Example

import { OpenAPIHono } from '@hono/zod-openapi'
import { configureOpenAPI } from '@rtorcato/api-openapi-hono'

const app = new OpenAPIHono()
configureOpenAPI(app, { document: { info: { title: 'My API', version: '1.0.0' } } })
// → GET /doc (OpenAPI JSON), GET /reference (Scalar UI)