@himenon/openapi-typescript-code-generator
Version:
OpenAPI Code Generator using TypeScript AST.
50 lines (47 loc) • 1.74 kB
text/typescript
import { D as Document, C as CustomGenerator, P as Params } from './CodeGenerator-BT1x2VUP.cjs';
import { O as Option$1 } from './Validator-BDeib3uY.cjs';
import { O as Options } from './ConverterContext-BojqruZC.cjs';
import 'typescript';
import 'json-schema';
interface Option {
allowOperationIds?: string[];
convertOption: Options;
}
declare class CodeGenerator {
private readonly entryPointOrDocument;
private option?;
private rootSchema;
private resolvedReferenceDocument;
private parser;
constructor(entryPointOrDocument: string | Document, option?: Option | undefined);
private createParser;
/**
* Validate the OpenAPI Schema
*/
validateOpenApiSchema(option?: Option$1): void;
/**
* Provides TypeScript typedefs generated from OpenAPI Schema.
*
* @param generatorTemplate Template for when you want to change the code following a type definition
* @returns String of generated code
*/
generateTypeDefinition(generatorTemplates?: CustomGenerator<any>[], allowOperationIds?: string[]): string;
/**
* Generate code using a template
*
* @param generatorTemplate
* @returns String of generated code
*/
generateCode(generatorTemplates: CustomGenerator<any>[], allowOperationIds?: string[]): string;
/**
* Provides parameters extracted from OpenApi Schema
*/
getCodeGeneratorParamsArray(allowOperationIds?: string[]): Params[];
/**
* Provides types for parameters for Templates.FunctionalApiClient.
*
* This API will be moved to Templates in the future.
*/
getAdditionalTypeDefinitionCustomCodeGenerator(): CustomGenerator<undefined>;
}
export { CodeGenerator, type Option };