From 1233c33116a389f34ac90768c5ef43c8bbfbf514 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Feb 2018 16:23:20 +0100 Subject: Address feedback --- packages/website/ts/schemas/validator.ts | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'packages/website/ts/schemas/validator.ts') diff --git a/packages/website/ts/schemas/validator.ts b/packages/website/ts/schemas/validator.ts index 14061e2a3..f0b5e6676 100644 --- a/packages/website/ts/schemas/validator.ts +++ b/packages/website/ts/schemas/validator.ts @@ -1,21 +1,12 @@ +import { SchemaValidator } from '@0xproject/json-schemas'; import { Schema as JSONSchema, Validator } from 'jsonschema'; import { orderMetadataSchema } from 'ts/schemas/metadata_schema'; import { orderSchema } from 'ts/schemas/order_schema'; -import { signatureDataSchema } from 'ts/schemas/signature_data_schema'; -import { signedOrderSchema } from 'ts/schemas/signed_order_schema'; import { tokenSchema } from 'ts/schemas/token_schema'; -export class SchemaValidator { - private _validator: Validator; - constructor() { - this._validator = new Validator(); - this._validator.addSchema(signatureDataSchema as JSONSchema, signatureDataSchema.id); - this._validator.addSchema(tokenSchema as JSONSchema, tokenSchema.id); - this._validator.addSchema(orderMetadataSchema as JSONSchema, orderMetadataSchema.id); - this._validator.addSchema(signedOrderSchema as JSONSchema, signedOrderSchema.id); - this._validator.addSchema(orderSchema as JSONSchema, orderSchema.id); - } - public validate(instance: object, schema: Schema) { - return this._validator.validate(instance, schema); - } -} +const validator = new SchemaValidator(); +validator.addSchema(tokenSchema); +validator.addSchema(orderMetadataSchema); +validator.addSchema(orderSchema); + +export { validator }; -- cgit