diff options
author | Fabio Berger <me@fabioberger.com> | 2018-02-26 10:32:12 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-02-26 10:32:12 +0800 |
commit | fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4 (patch) | |
tree | 21f9398ba2975bda4706fb8f54c0c717b88ecfd4 /packages/assert | |
parent | 66b36f6d8f7c0f0487e53badb035ac50e1ec5669 (diff) | |
parent | 709fa9e02ec21cee9fc145b4a578742c8dd190aa (diff) | |
download | dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar.gz dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar.bz2 dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar.lz dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar.xz dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.tar.zst dexon-sol-tools-fffaafe4c996ac0c458dd6cb9e3598b1d93b7aa4.zip |
Merge branch 'development' into moveOutDocGenerator
* development: (36 commits)
Fix english translations
Fix footer on mobile
re-add google analytics code
Fix Russian translation
Move all dependencies on @0xproject/types out of devDependencies
Slight improvement to footer
Fix a few Korean translations
Address feedback
Use source tree hash instead of compile flag
Fix race condition
Update CHANGELOG
Delete artifacts directory
Add generated contract artifacts to gitignore
Check dependencies when determining if should be recompiled
Update CHANGELOG
Remove unused CHANGELOG entry
Remove unused import
Change assert.doesConformToShema interface
Remove a type assertion
Publish
...
Diffstat (limited to 'packages/assert')
-rw-r--r-- | packages/assert/CHANGELOG.md | 4 | ||||
-rw-r--r-- | packages/assert/package.json | 6 | ||||
-rw-r--r-- | packages/assert/src/index.ts | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index 23c2c5e56..f512f7b10 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.1.0 - _TBD, 2018_ + + * Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385) + ## v0.0.18 - _February 9, 2017_ * Fix publishing issue where .npmignore was not properly excluding undesired content (#389) diff --git a/packages/assert/package.json b/packages/assert/package.json index 50e601702..0a1659dd8 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "0.0.19", + "version": "0.0.20", "description": "Provides a standard way of performing type and schema validation across 0x projects", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -38,8 +38,8 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.11", - "@0xproject/utils": "^0.3.3", + "@0xproject/json-schemas": "^0.7.12", + "@0xproject/utils": "^0.3.4", "lodash": "^4.17.4", "valid-url": "^1.0.9" } 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} |