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.

36 lines (35 loc) 1.2 kB
import { ModuleImports, OpenAPISpecification } from '../../models'; export interface GenerateModelCodeOptions { /** * The open api specification to use when looking up schemas */ openAPISpecification: OpenAPISpecification; /** * The name of the schema to generate code for */ schemaName: string; /** * Whether to generate code for tsed controllers */ generateTsEDControllers?: boolean; /** * Whether to infer the type from the validation schema */ inferTypeFromValidationSchema?: boolean; } /** * Generates model code for a given schema * * @param options The options to generate model code. * @returns The generated model code */ export declare const generateModelCode: ({ schemaName, openAPISpecification, generateTsEDControllers, inferTypeFromValidationSchema, }: GenerateModelCodeOptions) => { tsedModelCode?: string | undefined; tsedModelName?: string | undefined; generatedVariables?: Record<string, string> | undefined; zodValidationSchemaCode: string; referencedSchemas: string[]; zodValidationSchemaName: string; inferedTypeCode: string; imports: ModuleImports; } | undefined;