hey-api-builders
Version:
A custom plugin for @hey-api/openapi-ts that generates mock data builders with a lightweight custom runtime, Zod integration, or static mock generation.
58 lines • 1.74 kB
TypeScript
import type { Schema, MockStrategy } from '../types';
/**
* Code generation utilities
*/
/**
* Generates with* methods for builder classes
* @param schema - JSON Schema
* @param typeName - TypeScript type name
* @returns Generated method code
*/
export declare function generateWithMethods(schema: Schema, typeName: string): string;
/**
* Generates import statements
* @param options - Import options
* @returns Import statements
*/
export declare function generateImports(options: {
mockStrategy: MockStrategy;
generateZod: boolean;
}): string;
/**
* Generates BuilderOptions type definition
* @returns Type definition code
*/
export declare function generateBuilderOptionsType(): string;
/**
* Generates schema constants for JSF
* @param metas - Schema metadata
* @returns Schema constant code
*/
export declare function generateSchemaConstants(metas: Array<{
constName: string;
schema: Schema;
}>): string;
/**
* Generates a class property declaration
* @param name - Property name
* @param type - Property type
* @param value - Initial value
* @returns Property declaration
*/
export declare function generateProperty(name: string, type: string, value: string): string;
/**
* Generates a builder method
* @param name - Method name
* @param returnType - Return type
* @param body - Method body
* @returns Method declaration
*/
export declare function generateMethod(name: string, returnType: string, body: string): string;
/**
* Indents code by a specified number of spaces
* @param code - Code to indent
* @param spaces - Number of spaces
* @returns Indented code
*/
export declare function indent(code: string, spaces: number): string;
//# sourceMappingURL=code-generator.d.ts.map