diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-24 05:20:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-24 05:20:28 +0800 |
commit | 10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32 (patch) | |
tree | db5b0c66958d8ea6f77e0bdcf0e1bae2fdb13af1 /packages/assert/src/index.ts | |
parent | 3d2c5d67afb6a754ed7a0b883ff93bf330660eff (diff) | |
parent | 3120d854f855a01ad7bce3427a64d931de1879d3 (diff) | |
download | dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar.gz dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar.bz2 dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar.lz dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar.xz dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.tar.zst dexon-sol-tools-10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32.zip |
Merge pull request #385 from 0xProject/feature/0x_config_validation
Better validate ZeroExConfig on private networks
Diffstat (limited to 'packages/assert/src/index.ts')
-rw-r--r-- | packages/assert/src/index.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 7ad574ec7..4d090e493 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -66,8 +66,11 @@ export const assert = { const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync); this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value)); }, - doesConformToSchema(variableName: string, value: any, schema: Schema): void { + doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void { const schemaValidator = new SchemaValidator(); + if (!_.isUndefined(subSchemas)) { + _.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator)); + } const validationResult = schemaValidator.validate(value, schema); const hasValidationErrors = validationResult.errors.length > 0; const msg = `Expected ${variableName} to conform to schema ${schema.id} |