diff options
Diffstat (limited to 'packages/website/ts/schemas/validator.ts')
-rw-r--r-- | packages/website/ts/schemas/validator.ts | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/packages/website/ts/schemas/validator.ts b/packages/website/ts/schemas/validator.ts index 5177501c6..dac0f0098 100644 --- a/packages/website/ts/schemas/validator.ts +++ b/packages/website/ts/schemas/validator.ts @@ -1,19 +1,12 @@ +import { SchemaValidator } from '@0xproject/json-schemas'; import { Schema as JSONSchema, Validator } from 'jsonschema'; -import { orderSchema } from 'ts/schemas/order_schema'; -import { orderTakerSchema } from 'ts/schemas/order_taker_schema'; -import { signatureDataSchema } from 'ts/schemas/signature_data_schema'; -import { tokenSchema } from 'ts/schemas/token_schema'; +import { orderMetadataSchema } from 'ts/schemas/metadata_schema'; +import { portalOrderSchema } from 'ts/schemas/portal_order_schema'; +import { portalTokenMetadataSchema } from 'ts/schemas/portal_token_metadata'; -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(orderTakerSchema as JSONSchema, orderTakerSchema.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(portalTokenMetadataSchema); +validator.addSchema(orderMetadataSchema); +validator.addSchema(portalOrderSchema); + +export { validator }; |