oas-normalize
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,8 @@ | ||
## <small>3.0.1 (2021-06-07)</small> | ||
* fix: `validate` will now reject the promise on validation errors ([3a2a0da](https://github.com/readmeio/oas-normalize/commit/3a2a0da)) | ||
* docs: fixing a typo in the readme ([f538aff](https://github.com/readmeio/oas-normalize/commit/f538aff)) | ||
## 3.0.0 (2021-06-03) | ||
@@ -2,0 +9,0 @@ |
31
index.js
@@ -92,22 +92,21 @@ const fetch = require('node-fetch'); | ||
await SwaggerParser.validate(schema).catch(err => { | ||
const error = new Error(err.message.replace(/\[object Object\]/g, 'Schema')); | ||
error.full = err; | ||
if (err.details && err.details.length) { | ||
return Promise.resolve({ | ||
errors: [ | ||
{ | ||
message: err.details[0].message, | ||
path: err.details[0].path, | ||
}, | ||
], | ||
full: err, | ||
}); | ||
} | ||
return Promise.resolve({ | ||
errors: [ | ||
error.errors = [ | ||
{ | ||
message: err.details[0].message, | ||
path: err.details[0].path, | ||
}, | ||
]; | ||
} else { | ||
error.errors = [ | ||
{ | ||
message: err.message.replace(/\[object Object\]/g, 'Schema'), | ||
}, | ||
], | ||
full: err, | ||
}); | ||
]; | ||
} | ||
return Promise.reject(error); | ||
}) | ||
@@ -114,0 +113,0 @@ ); |
{ | ||
"name": "oas-normalize", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Swagger 2 or OAS 3? YAML or JSON? URL, path, string or object? Who cares! It just works.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,3 +60,3 @@ Swagger 2 or OAS 3? YAML or JSON? URL, path, string or object? Who cares! It just works. | ||
| `.deref()` | Resolve `$ref` pointers | | ||
| `.validate([convertToLatest?]))` | Validate the whole thing! | | ||
| `.validate([convertToLatest?])` | Validate the whole thing! | | ||
@@ -63,0 +63,0 @@ # Other little features |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29446
1
142