UNPKG

@infinite-debugger/swagger-to-ts

Version:

swagger-to-ts is a powerful library that allows you to generate TypeScript code from Swagger documentation or OpenAPI specifications. It simplifies the process of integrating API definitions into your TypeScript projects, saving you time and effort.

129 lines (128 loc) 3.92 kB
import { z } from 'zod'; import { Content } from './Content'; import { Responses } from './Response'; import { Schema } from './Schema'; export declare const requestMethods: readonly ["get", "post", "put", "delete", "patch"]; export type RequestMethod = (typeof requestMethods)[number]; export declare const BaseRequestParameterValidationSchema: z.ZodObject<any, "strip", z.ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>; export type BaseRequestParameter = { required?: boolean; name: string; description?: string; schema: Schema; example?: any; }; export declare const requestParameterLocations: readonly ["query", "header", "path", "cookie"]; export type RequestParameterLocation = (typeof requestParameterLocations)[number]; export declare const RequestParameterValidationSchema: z.ZodObject<{ [x: string]: any; }, "strip", z.ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>; export type RequestParameter = BaseRequestParameter & { /** * The request parameter location. */ in: RequestParameterLocation; }; export declare const RequestBodyValidationSchema: any; export type RequestBody = { required?: boolean; content?: Content; description?: string; }; export declare const RequestConfigValidationSchema: z.ZodObject<{ tsedControllerConfig: z.ZodOptional<z.ZodObject<{ permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; path: z.ZodOptional<z.ZodString>; responseHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; streamAPIResponse: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { permissions?: string[] | undefined; path?: string | undefined; responseHeaders?: Record<string, string> | undefined; streamAPIResponse?: boolean | undefined; }, { permissions?: string[] | undefined; path?: string | undefined; responseHeaders?: Record<string, string> | undefined; streamAPIResponse?: boolean | undefined; }>>; apiFunctionConfig: z.ZodOptional<z.ZodObject<{ responseType: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { responseType?: string | undefined; }, { responseType?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { tsedControllerConfig?: { permissions?: string[] | undefined; path?: string | undefined; responseHeaders?: Record<string, string> | undefined; streamAPIResponse?: boolean | undefined; } | undefined; apiFunctionConfig?: { responseType?: string | undefined; } | undefined; }, { tsedControllerConfig?: { permissions?: string[] | undefined; path?: string | undefined; responseHeaders?: Record<string, string> | undefined; streamAPIResponse?: boolean | undefined; } | undefined; apiFunctionConfig?: { responseType?: string | undefined; } | undefined; }>; export type RequestConfig = z.infer<typeof RequestConfigValidationSchema>; export declare const RequestValidationSchema: z.ZodObject<any, "strip", z.ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>; export type Request = { /** * The request description. */ description?: string; /** * The request operation id. */ operationId?: string; /** * The request parameters. */ parameters?: RequestParameter[]; /** * The request body. */ requestBody?: RequestBody; /** * The request responses. */ responses: Responses; /** * The request summary. */ summary?: string; /** * Whether the request is deprecated. */ deprecated?: boolean; /** * The request tags. */ tags: string[]; /** * The custom request configuration. */ 'x-requestConfig'?: RequestConfig; } & Record<string, any>;