From c4ae91c7c5aaa2d6e278448667bf828162be93bc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 18 Oct 2018 17:31:38 +0100 Subject: Update doc ref markdown sections --- packages/website/md/docs/json_schemas/3/usage.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/website/md/docs/json_schemas/3/usage.md (limited to 'packages/website/md/docs/json_schemas/3/usage.md') diff --git a/packages/website/md/docs/json_schemas/3/usage.md b/packages/website/md/docs/json_schemas/3/usage.md new file mode 100644 index 000000000..2b72eeaad --- /dev/null +++ b/packages/website/md/docs/json_schemas/3/usage.md @@ -0,0 +1,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 +``` -- cgit