@povio/openapi-codegen-cli
Version:
**NOTE:** This CLI tool is primarily designed for use within our organization. The generated code output aligns with our internal template. If you are using this tool without our internal template, make sure to use it in **standalone** mode.
72 lines (71 loc) • 3.27 kB
TypeScript
import { OpenAPIV3 } from "openapi-types";
import { OperationObject } from "src/generators/types/openapi";
import { GenerateOptions } from "src/generators/types/options";
import { ValidationError } from "src/generators/types/validation";
import { DependencyGraph } from "./openapi/getOpenAPISchemaDependencyGraph";
import { ZodSchema } from "./zod/ZodSchema.class";
interface SchemaData {
ref: string;
name: string;
zodSchemaName: string;
tags: string[];
deepRefOperations: OperationObject[];
}
export interface EnumZodSchemaData {
code: string;
zodSchemaName: string;
tag?: string;
}
export interface ExtractedEnumZodSchemaData {
code: string;
zodSchemaName?: string;
tag?: string;
meta: {
zodSchemaNameSegments: string[][];
tags: string[];
schemaRefs: string[];
schemas: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
};
}
export declare class SchemaResolver {
readonly openApiDoc: OpenAPIV3.Document;
readonly options: GenerateOptions;
private readonly schemaData;
private readonly zodSchemaData;
private readonly compositeZodSchemaData;
readonly dependencyGraph: DependencyGraph;
readonly enumZodSchemas: EnumZodSchemaData[];
readonly extractedEnumZodSchemaData: ExtractedEnumZodSchemaData[];
readonly operationsByTag: Record<string, OperationObject[]>;
readonly operationNames: string[];
readonly validationErrors: ValidationError[];
private get docSchemas();
private get schemaRefs();
constructor(openApiDoc: OpenAPIV3.Document, options: GenerateOptions);
getSchemaByRef(ref: string): OpenAPIV3.SchemaObject;
getSchemaDataByName(name: string): SchemaData | undefined;
getZodSchemaNameByRef(ref: string): string;
getRefByZodSchemaName(zodSchemaName: string): string | undefined;
getTagByZodSchemaName(zodSchemaName: string): string;
getCodeByZodSchemaName(name: string): string | undefined;
getZodSchemaNamesByCompositeCode(code: string): string[] | undefined;
setZodSchema(name: string, code: string, tag: string): void;
addZodSchemaForCompositeCode(code: string, zodSchema: ZodSchema, zodSchemaName: string, schema?: OpenAPIV3.SchemaObject): void;
getCompositeZodSchemaByZodSchemaName(zodSchemaName: string): ZodSchema | undefined;
getSchemaByCompositeZodSchemaName(compositeZodSchemaName: string): OpenAPIV3.SchemaObject | undefined;
getEnumZodSchemaDataByCode(code: string): EnumZodSchemaData | undefined;
getExtractedEnumZodSchemaDataByCode(code: string): ExtractedEnumZodSchemaData | undefined;
getExtractedEnumZodSchemaNamesReferencedBySchemaRef(schemaRef: string): string[];
getZodSchemas(): {};
getExtractedEnumZodSchemas(): {};
resolveObject<T>(obj: OpenAPIV3.ReferenceObject | T): T;
isSchemaCircular(ref: string): boolean;
getCircularSchemaChain(ref: string, currentRef?: string, chain?: never[], visited?: string[]): string[];
getBaseUrl(): string;
getZodSchemaObj(zodSchemaName: string): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | undefined;
private getSchemaDataByRef;
private getExtractedEnumZodSchemaDataByName;
private initialize;
private handleDuplicateEnumZodSchemas;
}
export {};