Comparing version 2.5.7 to 3.0.0
@@ -69,16 +69,14 @@ "use strict"; | ||
function addCustomFormats(ajv, customFormats) { | ||
return Object.keys(customFormats).reduce((result, key) => { | ||
for (const key of Object.keys(customFormats)) { | ||
const customFormat = customFormats[key]; | ||
if (typeof customFormat === 'function' || customFormat instanceof RegExp) { | ||
result[key] = { type: 'string', validate: customFormat }; | ||
ajv.addFormat(key, { type: 'string', validate: customFormat }); | ||
} | ||
else if (customFormat.type === 'string') { | ||
result[key] = { type: 'string', validate: customFormat.validate }; | ||
ajv.addFormat(key, { type: 'string', validate: customFormat.validate }); | ||
} | ||
else if (customFormat.type === 'number') { | ||
result[key] = { type: 'number', validate: customFormat.validate }; | ||
ajv.addFormat(key, { type: 'number', validate: customFormat.validate }); | ||
} | ||
ajv.addFormat(key, result[key]); | ||
return result; | ||
}, {}); | ||
} | ||
} | ||
@@ -161,3 +159,3 @@ function removeExamples(schema) { | ||
errors = ajvValidate.errors.map((err) => { | ||
let pathPtr = err.dataPath || ''; | ||
let pathPtr = err.instancePath || ''; | ||
if (pathPtr.startsWith('/value')) { | ||
@@ -210,4 +208,2 @@ pathPtr = pathPtr.slice(6); | ||
removeAdditional: allowTypeCoercion ? 'failing' : false, | ||
jsonPointers: true, | ||
nullable: true, | ||
allErrors: schemaContext.options.allErrors, | ||
@@ -214,0 +210,0 @@ }); |
{ | ||
"name": "exegesis", | ||
"version": "2.5.7", | ||
"version": "3.0.0", | ||
"description": "Parses OpenAPI documents", | ||
@@ -54,3 +54,2 @@ "main": "lib/index.js", | ||
"@types/json-schema": "^7.0.3", | ||
"@types/json-schema-traverse": "^0.4.0", | ||
"@types/lodash": "^4.14.132", | ||
@@ -82,3 +81,3 @@ "@types/mocha": "^8.0.0", | ||
"@apidevtools/json-schema-ref-parser": "^9.0.3", | ||
"ajv": "^6.12.2", | ||
"ajv": "^8.3.0", | ||
"body-parser": "^1.18.3", | ||
@@ -85,0 +84,0 @@ "content-type": "^1.0.4", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31
318907
4967
+ Addedajv@8.17.1(transitive)
+ Addedfast-uri@3.0.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
- Removedajv@6.12.6(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedpunycode@2.3.1(transitive)
- Removeduri-js@4.4.1(transitive)
Updatedajv@^8.3.0