Comparing version 2.3.0 to 2.3.1-empty-merge-6c5f411f3eac1b032bd0079852d4ff2bbbd45fa5
@@ -7,4 +7,8 @@ # Change Log | ||
## v2.3.0 - 2018-09-06 | ||
## v2.3.1 - 2018-10-08 | ||
* Merge: When merging an empty array, return a wildcard schema [Lucian Buzzo] | ||
## v2.3.0 - 2018-09-05 | ||
* Feat: Add functionality for scoring a schema match by specificity [Lucian Buzzo] | ||
@@ -11,0 +15,0 @@ |
@@ -571,2 +571,10 @@ /* | ||
exports.merge = (schemas) => { | ||
// If no schemas are provided, return a "wildcard" skhema | ||
if (schemas.length === 0) { | ||
return { | ||
type: 'object', | ||
additionalProperties: true | ||
} | ||
} | ||
if (schemas.length === 1 && schemas[0].type) { | ||
@@ -573,0 +581,0 @@ return schemas[0] |
{ | ||
"name": "skhema", | ||
"version": "2.3.0", | ||
"version": "2.3.1-empty-merge-6c5f411f3eac1b032bd0079852d4ff2bbbd45fa5", | ||
"description": "JSON Schema utility collection", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -651,2 +651,13 @@ /* | ||
ava.test('.merge() should add `additionalProperties` true, if merging an empty array', (test) => { | ||
const schemas = [] | ||
const finalSchema = skhema.merge(schemas) | ||
test.deepEqual(finalSchema, { | ||
type: 'object', | ||
additionalProperties: true | ||
}) | ||
}) | ||
_.each(SCORE_TEST_CASES, (testCase, index) => { | ||
@@ -653,0 +664,0 @@ ava.test(`.scoreMatch() should merge test case ${index}`, (test) => { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
69852
5438
2160
1