UNPKG

bookish-potato-dto

Version:

A TypeScript DTO (Data Transfer Object) parsing and validation library. Define a schema once — get runtime validation and a fully inferred TypeScript type for free.

21 lines (20 loc) 755 B
import { DtoDefinition } from '../schema/dto-definition.type'; import { OpenApiSchema } from './openapi-schema.type'; /** * Options for generating OpenAPI schema. */ export interface GenerateOpenApiOptions { /** * Defines how to generate names for DTOs in the 'components/schemas' section. * If not provided, UUIDs will be used. */ readonly nameResolver?: (dto: DtoDefinition) => string; } /** * Generates an OpenAPI schema for a given DTO definition. * It also returns all referenced DTOs to help build the 'components/schemas' section. */ export declare function generateOpenApi(dto: DtoDefinition, options?: GenerateOpenApiOptions): { readonly schema: OpenApiSchema; readonly refs: Record<string, OpenApiSchema>; };