@lcap/asl
Version:
NetEase Application Specific Language
95 lines (94 loc) • 2.62 kB
TypeScript
import { Schema } from '..';
/**
* 会改变原来的结构,最好自己做深拷贝
* @param schema
* @param root
* @example RefType - 用于前端界面的类型描述
* {
* asset: {
* type: 'object',
* propertyList: [
* { name: 'id', $ref: '#/basicType/Long' },
* { name: 'name', $ref: '#/basicType/String' },
* ],
* },
* assetType: {
* type: 'enum',
* enumItemList: [
* { value: 'COMPUTER', label: '台式机' },
* { value: 'TABLET', label: '平板电脑' },
* { value: 'MOBILE', label: '移动电话' },
* },
* },
* assets: {
* isArray: true,
* $ref: '#/xxxx/entity/asset'
* },
* test: { $ref: '#/basicType/Date' }
* }
*/
export declare function convert2RefType(schema: Schema): Schema;
/**
* 会改变原来的结构,最好自己做深拷贝
* @param schema
* @param root
* @example SchemaType - 非标准的 JSON Schema 结构
* {
* asset: {
* type: 'object',
* propertyList: [
* { type: 'int', format: 'long' },
* { type: 'string' },
* ],
* },
* assetType: {
* type: 'enum',
* enumItemList: [
* { value: 'COMPUTER', label: '台式机' },
* { value: 'TABLET', label: '平板电脑' },
* { value: 'MOBILE', label: '移动电话' },
* },
* },
* assets: {
* isArray: true,
* items: {
* $ref: '#/xxxx/entity/asset'
* }
* },
* test: { type: 'string', format: 'date' }
* }
*/
export declare function convert2SchemaType(schema: Schema, options?: {
enum?: string;
}): Schema;
/**
* 根据 Ref Schema 生成子节点
* @param schema
* @param code
* @param dataTypesMap
*/
export declare function genSchemaChildren(schema: Schema, code?: string, usedSchemaRefs?: {
[name: string]: boolean;
}): Array<any>;
/**
* 根据 Ref Schema 生成子节点
* @param schema
* @param code
*/
export declare function genRefSchemaChildren(schema: Schema, code: string, usedSchemaRefs?: {
[name: string]: boolean;
}): Array<any>;
/**
* 根据 Ref Schema 生成子节点
* @param schema
* @param code
*/
export declare function genFullRefSchemaChildren(schema: Schema, code: string, usedSchemaRefs?: {
[name: string]: boolean;
}): Array<any>;
/**
* 统一在 lcap-pc-template 中处理
*/
export declare function genInitData(schema: Schema, relationship?: string, usedSchemaRefs?: {
[name: string]: boolean;
}): any;