openapi-ts-request
Version:
Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas
66 lines (65 loc) • 1.82 kB
TypeScript
import type { ProjectOptions } from 'ts-morph';
import type { OperationObject, ParameterObject, SchemaObject } from '../type';
import { type MutuallyExclusive } from '../type';
import type { TypescriptFileType } from './config';
export type ITypescriptFileType = keyof typeof TypescriptFileType;
export interface APIDataType extends OperationObject {
path: string;
method: string;
}
export type TagAPIDataType = Record<string, APIDataType[]>;
export interface ControllerType {
fileName: string;
controllerName: string;
}
export interface IPropBasicObject {
name: string;
desc: string;
required?: boolean;
type: string;
}
export type IPropObject = IPropBasicObject & Partial<Omit<SchemaObject, 'type' | 'required'>>;
export interface ITypeItem {
typeName: string;
type: string | boolean | SchemaObject;
props: IPropObject[][];
isEnum: boolean;
displayLabelFuncName?: string;
enumLabelType?: string;
description?: string;
}
export type ICustomSchemaObject = SchemaObject & {
isAllowed?: boolean;
};
export type ICustomParameterObject = ParameterObject & {
isObject: boolean;
type: string;
};
export interface ISchemaItem {
typeName: string;
type: string;
}
export declare enum MergeRule {
LEFT = "left",
RIGHT = "right"
}
export type MergeOption = MutuallyExclusive<{
source: string;
srcPath: string;
}>;
type MergerOptionProps = {
mergeRule: MergeRule;
projectOptions: ProjectOptions;
};
export type MergerOptions = MergeOption & Partial<MergerOptionProps>;
export type IServiceControllerPayload<T> = {
namespace: string;
requestOptionsType: string;
requestImportStatement: string;
interfaceFileName: string;
list: {
customTemplate: boolean;
data: string;
}[] | T;
};
export {};