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.

52 lines (51 loc) 1.63 kB
import { ModuleImports } from '../../models'; import { ObjectSchema, Schema } from '../../models/OpenAPISpecification/Schema'; export interface GeneratePropertySchemaCodeOptions { /** * The schema that the property belongs to */ schema: ObjectSchema; /** * The name of the schema that the property belongs to */ schemaName: string; /** * The property schema to generate code for */ propertySchema: Schema; /** * The name of the property on the schema to generate code for */ propertyName: string; /** * Whether to generate code for tsed controllers */ generateTsEDControllers?: boolean; } /** * Generates string schema code for a given schema * * @param options The options to generate string schema code * @returns The generated string schema code */ export declare const generatePropertySchemaCode: (options: GeneratePropertySchemaCodeOptions) => { referencedSchemas: string[]; imports: ModuleImports; generatedVariables: Record<string, string>; required?: boolean | undefined; openAPISpecification: Schema; propertyName: string; propertyType: string; propertyModels: string[]; decorators: string[]; accessModifier: "public" | "private" | "protected"; isNullable?: boolean | undefined; zodCodeString: string; }; /** * Gets the models referenced by a property type * * @param propertyType The property type to get the models referenced by * @returns The models referenced by the property type */ export declare const getModelsReferencedByPropertyType: (propertyType: string) => any[];