@lcap/asl
Version:
NetEase Application Specific Language
165 lines (164 loc) • 3.82 kB
TypeScript
import { Entity, EntityProperty } from '..';
import Schema from './Schema';
export declare const ENTITY_STRUCTURE_PREFIX: string[];
export declare const ENTITY_INTERFACE_PREFIX: string[];
interface Parameter {
name: string;
in: string;
required: boolean;
schema: Schema;
entityFieldId?: string;
[name: string]: any;
}
declare type Parameters = {
[name: string]: Parameter;
};
/**
* 获取实体相关的所有数据结构的名称
* @param entityName 实体名称
*/
export declare const getEntityStructureNames: (entityName: string) => string[];
/**
* 获取实体相关的所有数据结构
* @param entity 实体
*/
export declare function getEntityStructures(entity: Entity): ({
name: string;
type: string;
propertyList: ({
level: string;
name: string;
description: string;
$ref: string;
isArray: boolean;
} | {
level: string;
name: string;
description: string;
$ref: string;
isArray?: undefined;
})[];
structureRef?: undefined;
} | {
name: string;
type: string;
propertyList: ({
level: string;
name: string;
description: string;
$ref: string;
type?: undefined;
format?: undefined;
} | {
level: string;
name: string;
description: string;
type: string;
format: string;
$ref: string;
})[];
structureRef: string;
} | {
name: string;
type: string;
propertyList: {
level: string;
name: string;
$ref: string;
}[];
structureRef?: undefined;
})[];
/**
* 获取实体相关的所有 GET 接口请求参数
* @param entity 实体
*/
export declare function getEntityGetAllQueryParams(entity: Entity): Parameters;
/**
* 获取实体某个属性相关的所有接口参数
* @param property 实体属性
* @param dataTypesMap
*/
export declare function getEntityPropertyParams(property: EntityProperty): Parameters;
/**
* 获取实体相关的所有接口
* @param entity 实体
*/
export declare function getEntityInterfaces(entity: Entity): ({
data: {
name: string;
method: string;
path: string;
description: string;
parameters: string;
responses: string;
requestBody?: undefined;
};
resolver: {
ast: {
type: string;
object: {
type: string;
object: {
type: string;
name: string;
};
property: {
type: string;
name: string;
};
};
property: {
type: string;
name: string;
};
};
code: string;
};
} | {
data: {
name: string;
method: string;
path: string;
description: string;
parameters: string;
responses: string;
requestBody?: undefined;
};
resolver: {
ast: {
type: string;
object: {
type: string;
name: string;
};
property: {
type: string;
name: string;
};
};
code: string;
};
} | {
data: {
name: string;
method: string;
path: string;
description: string;
parameters: string;
requestBody: string;
responses: string;
};
resolver: {};
} | {
data: {
name: string;
method: string;
path: string;
description: string;
parameters: string;
responses: string;
requestBody?: undefined;
};
resolver: {};
})[];
export {};