openapi-typescript
Version:
Convert OpenAPI 3.0 & 3.1 schemas to TypeScript
27 lines (26 loc) • 1.31 kB
TypeScript
import c from "ansi-colors";
import ts from "typescript";
import type { DiscriminatorObject, OpenAPI3, OpenAPITSOptions } from "../types.js";
export { c };
export declare function createDiscriminatorProperty(discriminator: DiscriminatorObject, { path, readonly }: {
path: string;
readonly?: boolean;
}): ts.TypeElement;
export declare function createRef(parts: (number | string | undefined | null)[]): string;
export declare function debug(msg: string, group?: string, time?: number): void;
export declare function error(msg: string): void;
export declare function formatTime(t: number): string;
export declare function getEntries<T>(obj: ArrayLike<T> | Record<string, T>, options?: {
alphabetize?: boolean;
excludeDeprecated?: boolean;
}): [string, T][];
export declare function resolveRef<T>(schema: any, $ref: string, { silent, visited }: {
silent: boolean;
visited?: string[];
}): T | undefined;
export declare function scanDiscriminators(schema: OpenAPI3, options: OpenAPITSOptions): {
objects: Record<string, DiscriminatorObject>;
refsHandled: string[];
};
export declare function walk(obj: unknown, cb: (value: Record<string, unknown>, path: (string | number)[]) => void, path?: (string | number)[]): void;
export declare function warn(msg: string, silent?: boolean): void;