mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-04-20 12:28:08 +00:00
1. 修复eslint问题 2. instanceOf => any 3. 修复node类型解析失败问题 Link: https://code.aone.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/codereview/3716330 * refactor: material parser code style
15 lines
355 B
TypeScript
15 lines
355 B
TypeScript
import Ajv from 'ajv';
|
|
import { Json } from '../types/Basic';
|
|
import schema from './schema.json';
|
|
|
|
const ajv = new Ajv({ jsonPointers: true });
|
|
const validate = ajv.compile(schema);
|
|
|
|
export default function validateSchema(json: Json) {
|
|
if (validate(json) === false) {
|
|
throw new Error(JSON.stringify(validate.errors, null, 2));
|
|
}
|
|
|
|
return true;
|
|
}
|