New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept response validation error handler #456
Conversation
232c6c0
to
4d36b22
Compare
cdc30cf
to
1d83cbb
Compare
apiSpec: apiSpecPath, | ||
validateResponses: { | ||
onError: function() { | ||
onErrorArgs = Array.from(arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add a test, where you re-throw the error and/or create a new error. looks like should all work out, but having a test will be good.
thanks for this @nampas |
one more note, please update the validateResponses section of the README to describe this new option |
9e22bb1
to
297cd92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nampas thanks for the feature
* Accept response validation error handler * Fewer args to onError * Another test * Additional test and readme updates
Here's a stab at the feature outlined here: #454
This PR adds a new
validateResponses.onError
option. There's no strong contract with the function, but express-openapi-validator will pass theerr
object, as well as the responsedata
. Usage might look something like this