diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-22 02:55:59 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-22 02:55:59 +0800 |
commit | e1341bc6d957d70a386c858cbdb64af5f284fd07 (patch) | |
tree | 5c6d76b4d179d51551c2bd051d48b04187033ef6 /packages/website/md/docs/json_schemas | |
parent | d437a660198a36c585f6cd5fe1bd13643da52ecb (diff) | |
download | dexon-sol-tools-e1341bc6d957d70a386c858cbdb64af5f284fd07.tar.gz dexon-sol-tools-e1341bc6d957d70a386c858cbdb64af5f284fd07.tar.zst dexon-sol-tools-e1341bc6d957d70a386c858cbdb64af5f284fd07.zip |
Move docs to page and add link to docs to README
Diffstat (limited to 'packages/website/md/docs/json_schemas')
-rw-r--r-- | packages/website/md/docs/json_schemas/usage.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/website/md/docs/json_schemas/usage.md b/packages/website/md/docs/json_schemas/usage.md new file mode 100644 index 000000000..372c0b541 --- /dev/null +++ b/packages/website/md/docs/json_schemas/usage.md @@ -0,0 +1,14 @@ +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 +``` |