ng-openapi-gen
Version:
An OpenAPI 3.0 and 3.1 codegen for Angular 16+
88 lines (87 loc) • 3.49 kB
TypeScript
import { Logger } from './logger';
import { Model } from './model';
import { Options } from './options';
import { OpenAPIObject, ReferenceObject, SchemaObject } from './openapi-typings';
export declare const HTTP_METHODS: string[];
type SchemaOrRef = SchemaObject | ReferenceObject;
/**
* Returns the simple name, that is, the last part after '/'
*/
export declare function simpleName(name: string): string;
/**
* Returns the unqualified model class name, that is, the last part after '.'
*/
export declare function unqualifiedName(name: string, options: Options): string;
/**
* Returns the qualified model class name, that is, the camelized namespace (if any) plus the unqualified name
*/
export declare function qualifiedName(name: string, options: Options): string;
/**
* Returns the filename where to write a model with the given name
*/
export declare function modelFile(name: string, options: Options): string;
/**
* Returns the namespace path, that is, the part before the last '.' split by '/' instead of '.'.
* If there's no namespace, returns undefined.
*/
export declare function namespace(name: string): string | undefined;
/**
* If the given name is a JS reserved keyword, suffix it with a `$` character
*/
export declare function ensureNotReserved(name: string): string;
/**
* Returns the type (class) name for a given regular name
*/
export declare function typeName(name: string, options?: Options): string;
/**
* Returns the name of the enum constant for a given value
*/
export declare function enumName(value: string, options: Options): string;
/**
* Returns a suitable method name for the given name
* @param name The raw name
*/
export declare function methodName(name: string): string;
/**
* Returns the file name for a given type name
*/
export declare function fileName(text: string): string;
/**
* Converts a text to a basic, letters / numbers / underscore representation.
* When firstNonDigit is true, prepends the result with an uderscore if the first char is a digit.
*/
export declare function toBasicChars(text: string, firstNonDigit?: boolean): string;
/**
* Returns the TypeScript comments for the given schema description, in a given indentation level
*/
export declare function tsComments(description: string | undefined, level: number, deprecated?: boolean): string;
/**
* Applies the prefix and suffix to a model class name
*/
export declare function modelClass(baseName: string, options: Options): string;
/**
* Applies the prefix and suffix to a service class name
*/
export declare function serviceClass(baseName: string, options: Options): string;
/**
* Escapes the name of a property / parameter if not valid JS identifier
*/
export declare function escapeId(name: string): string;
/**
* Returns the TypeScript type for the given type and options
*/
export declare function tsType(schemaOrRef: SchemaOrRef | undefined, options: Options, openApi: OpenAPIObject, container?: Model): string;
/**
* Resolves a reference
* @param ref The reference name, such as #/components/schemas/Name, or just Name
*/
export declare function resolveRef(openApi: OpenAPIObject, ref: string): any;
/**
* Recursively deletes a directory
*/
export declare function deleteDirRecursive(dir: string): void;
/**
* Synchronizes the files from the source to the target directory. Optionally remove stale files.
*/
export declare function syncDirs(srcDir: string, destDir: string, removeStale: boolean, logger: Logger): any;
export {};