15 lines
500 B
Markdown
15 lines
500 B
Markdown
The following example shows you how to validate an 0x order using the `@0xproject/json-schemas` package.
|
|
|
|
```javascript
|
|
import {SchemaValidator, ValidatorResult, schemas} from '@0xproject/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
|
|
```
|