UNPKG

express-zod-api

Version:

A Typescript framework to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.

32 lines (31 loc) 1.44 kB
import { D as ClientMethod, f as Tag } from "./routing-xQnwfH2D.js"; import { z } from "zod"; import { ReferenceObject, SchemaObjectValue, TagObject } from "openapi3-ts/oas32"; interface ReqResCommons { makeRef: (key: object | string, value: SchemaObjectValue | ReferenceObject, proposedName?: string) => ReferenceObject; path: string; method: ClientMethod; seenIds: Map<string, z.core.$ZodType>; } interface OpenAPIContext extends ReqResCommons { isResponse: boolean; } type Depicter = ( zodCtx: { zodSchema: z.core.$ZodType; jsonSchema: z.core.JSONSchema.BaseSchema; }, oasCtx: OpenAPIContext, ) => z.core.JSONSchema.BaseSchema | SchemaObjectValue; /** @desc Using defaultIsHeader when returns null or undefined */ type IsHeader = (name: string, method: ClientMethod, path: string) => boolean | null | undefined; type BrandHandling = Record<string | symbol, Depicter>; interface TagDetails extends Pick<TagObject, "summary" | "description" | "externalDocs" | "kind"> { /** @desc shorthand for externalDocs.url */ url?: string; parent?: Tag; } declare const depictTags: (tags: Partial<Record<Tag, string | TagDetails>>) => TagObject[]; /** @desc Ensures the summary string does not exceed the limit */ declare const trimSummary: (summary?: string, limit?: number) => string | undefined; export { depictTags as a, OpenAPIContext as i, Depicter as n, trimSummary as o, IsHeader as r, BrandHandling as t };