openapi-enforcer
Advanced tools
Comparing version 1.14.1 to 1.14.2
{ | ||
"name": "openapi-enforcer", | ||
"version": "1.14.1", | ||
"version": "1.14.2", | ||
"description": "Library for validating, parsing, and formatting data against open api schemas.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -186,4 +186,4 @@ /** | ||
} else { | ||
return value; | ||
return value | ||
} | ||
} |
const Exception = require('../exception'); | ||
const util = require('../util'); | ||
const SchemaValue = require('./value') | ||
@@ -7,2 +8,3 @@ const m1 = 'Unable to determine deserialization schema because too many schemas match. Use of a discriminator or making your schemas more specific would help this problem.' | ||
exports.anyOneOf = function (schema, value, exception, map, action, isSerialize, options) { | ||
if (value instanceof SchemaValue) value = value.value | ||
const key = schema.anyOf ? 'anyOf' : 'oneOf'; | ||
@@ -34,3 +36,3 @@ const exceptions = []; | ||
const properties = subSchema.properties || {}; | ||
const keys = Object.keys(value); | ||
const keys = Object.keys(result); | ||
const length = keys.length; | ||
@@ -48,3 +50,3 @@ for (let i = 0; i < length; i++) { | ||
if (score > 0 && !isSerialize && subSchema.validate(result)) score = 0; | ||
if (score > 0) matches.push({ score, result }) | ||
if (score > 0) matches.push({ score, result: util.copy(result) }) | ||
} | ||
@@ -51,0 +53,0 @@ }); |
Sorry, the diff of this file is too big to display
1512943
20657