turtle-express
Version:
`turtle-express` is kinda a framework or a library based on `express.js` with an opinionated express router with type safety and schema validation with zod. Also many [more features](https://github.com/mm-ninja-turtles/turtle-express/discussions/7) planni
20 lines • 1.12 kB
TypeScript
import type { z, ZodType } from 'zod';
export declare type OpenApiType = 'Response' | 'RequestParam' | 'RequestQuery' | 'RequestBody';
export interface OpenApiInfo<Schema extends ZodType> {
title: string;
schema: Schema;
type: OpenApiType;
mediaType?: string;
}
export declare type OpenApiRequestOptions<Schema extends ZodType> = Omit<OpenApiInfo<Schema>, 'type'> & {
type: Exclude<OpenApiType, 'Response'>;
};
export declare type OpenApiResponseOptions<Schema extends ZodType> = Omit<OpenApiInfo<Schema>, 'type'>;
export declare type ExtendsZodWithOpenApiReturnType<Schema extends ZodType> = Schema & {
_openApi: Omit<OpenApiInfo<Schema>, 'schema'>;
};
export declare function extendsZodWithOpenApi(zod: typeof z): typeof z & {
openApiRequest: <Schema extends z.ZodType<any, z.ZodTypeDef, any>>(options: OpenApiRequestOptions<Schema>) => ExtendsZodWithOpenApiReturnType<Schema>;
openApiResponse: <Schema_1 extends z.ZodType<any, z.ZodTypeDef, any>>(options: OpenApiResponseOptions<Schema_1>) => ExtendsZodWithOpenApiReturnType<Schema_1>;
};
//# sourceMappingURL=zod-extends-openapi.d.ts.map