swagger-ts-generator
Version:
Given a swagger.json file, generates a number of TypeScript files which can be used as models and model-driven forms in Angular 2 (and above)
123 lines (122 loc) • 3.41 kB
TypeScript
export interface IImportType {
importType: string;
importFile: string;
}
export interface IImportEnumType {
importEnumType: string;
}
export interface IType {
fileName: string;
typeName: string;
namespace: string;
fullNamespace: string;
fullTypeName: string;
importFile: string;
isSubType: boolean;
hasSubTypeProperty: boolean;
isBaseType: boolean;
baseType: IType;
baseImportFile: string;
path: string;
pathToRoot: string;
properties: ITypeProperty[];
get templateImportTypes(): IImportType[];
get templateImportEnumTypes(): IImportEnumType[];
}
export declare class Type implements IType {
fileName: string;
typeName: string;
namespace: string;
fullNamespace: string;
fullTypeName: string;
importFile: string;
isSubType: boolean;
hasSubTypeProperty: boolean;
isBaseType: boolean;
baseType: IType;
baseImportFile: string;
path: string;
pathToRoot: string;
properties: TypeProperty[];
constructor(values: Partial<IType>);
get templateImportTypes(): IImportType[];
get templateImportEnumTypes(): IImportEnumType[];
}
export interface IValidators {
validation: {
required: boolean;
minimum: number;
maximum: number;
enum: string;
minLength: number;
maxLength: number;
pattern: string;
};
validatorArray: string[];
}
export interface ITypeProperty {
name: string;
staticFieldName: string;
type: IType | IType[];
typeName: string;
interfaceTypeName: string;
isUnionType: boolean;
unionTypeNames: string[];
unionInterfaceTypeNames: string[];
namespace: string;
description: string;
isComplexType: boolean;
hasImportTypes: boolean;
hasUniqueImportTypes: boolean;
importTypes: string[];
importFiles: string[];
isEnum: boolean;
enum: string[];
isUniqueImportEnumType: boolean;
importEnumType: string;
isArray: boolean;
isArrayComplexType: boolean;
isArrayUnionType: boolean;
arrayTypeName: string;
arrayInterfaceTypeName: string;
hasValidation: boolean;
validators: IValidators;
get templateTypeNameForInstantiation(): string;
get templateTypeNameForComplexArray(): string;
get templateUseInstantiateSubType(): boolean;
}
export declare class TypeProperty implements ITypeProperty {
name: string;
staticFieldName: string;
type: IType | IType[];
typeName: string;
interfaceTypeName: string;
isUnionType: boolean;
unionTypeNames: string[];
unionInterfaceTypeNames: string[];
namespace: string;
description: string;
isComplexType: boolean;
hasImportTypes: boolean;
hasUniqueImportTypes: boolean;
importTypes: string[];
importFiles: string[];
isEnum: boolean;
enum: string[];
isUniqueImportEnumType: boolean;
importEnumType: string;
isArray: boolean;
isArrayComplexType: boolean;
isArrayUnionType: boolean;
arrayTypeName: string;
arrayInterfaceTypeName: string;
hasValidation: boolean;
validators: IValidators;
constructor(values: Partial<ITypeProperty>);
get templateTypeNameForInstantiation(): string;
get templateTypeNameForComplexArray(): string;
get templateUseInstantiateSubType(): boolean;
}
export interface INamespaceGroups {
[namespace: string]: Type[];
}