aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/assert/CHANGELOG.md4
-rw-r--r--packages/assert/src/index.ts4
2 files changed, 7 insertions, 1 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/src/index.ts b/packages/assert/src/index.ts
index 71f2cbeb2..4d090e493 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -68,7 +68,9 @@ export const assert = {
},
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
const schemaValidator = new SchemaValidator();
- _.map(subSchemas, schemaValidator.addSchema.bind(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}