0x-json-schemas 中文文档教程
json-schemas
包含 0x 相关的 json 模式
Usage:
import {SchemaValidator, ValidatorResult, schemas} from '0x-json-schemas';
const {orderSchema} = schemas;
const validator = new SchemaValidator();
const order = {
...
};
const validatorResult: ValidatorResult = validator.validate(order, orderSchema); // Contains all errors
const isValid: boolean = validator.isValid(order, orderSchema); // Only returns boolean
json-schemas
Contains 0x-related json schemas
Usage:
import {SchemaValidator, ValidatorResult, schemas} from '0x-json-schemas';
const {orderSchema} = schemas;
const validator = new SchemaValidator();
const order = {
...
};
const validatorResult: ValidatorResult = validator.validate(order, orderSchema); // Contains all errors
const isValid: boolean = validator.isValid(order, orderSchema); // Only returns boolean