class OpenApiService
implements IOpenApiService
Since 0.1.0

Service for generating and caching OpenAPI specifications.

Constructors

OpenApiService(options: OpenApiServiceOptions)

Creates a new OpenAPI service.

Parameters

Service options

Methods

addSchema(
name: string,
schema: unknown
): void

Registers a named schema for deduplication.

getSpec(): Readonly<Record<string, unknown>>

Returns the generated OpenAPI specification.

Builds the spec lazily on first call and caches it for subsequent calls.

Usage

import { OpenApiService } from "openapi-plugin/src/index.ts";