aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/md/docs/json_schemas/usage.md
blob: 68b80115320b042100eb4d056f678a42581c8cae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
The following example shows you how to validate a 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
```