aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/md/docs/json_schemas/3/usage.md
blob: 2b72eeaad30588ac23b1860768c856acd19ba884 (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 `@0x/json-schemas` package.

```javascript
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
```