-
Notifications
You must be signed in to change notification settings - Fork 370
validation errors are swallowed #355
Comments
fix in index.js //...
args.push(function (err, results) {
if (results && results.errors.length + _.reduce(results.apiDeclarations || [], function (count, apiDeclaration) {
return count += (apiDeclaration ? apiDeclaration.errors.length : 0);
}, 0) > 0) {
err = new Error('Swagger document(s) failed validation so the server cannot start');
err.failedValidation = true; // <--- this is the addition
err.results = results;
}
debug(' Validation: %s', err ? 'failed' : 'succeeded');
//... |
I think this is a duplicate of #327. If you agree, do you mind closing this? |
@whitlockjc - thanks for the quick reply! I had looked at #327 before, but I think there is a difference: As far as I can tell (and definitely for my case), adding the one line referenced in my previous comment does the trick. err.failedValidation = true; |
Let's keep it open then. I realize that |
ok, yeah ... in this case, a new |
Do you want to create a PR? I could help you out if need be. If not, I can whip this up pretty quickly. |
#355 Set failedValidation in initializeMiddleware call
|
awesome - thanks for yours
|
if I call
initializeMiddelware
with a bad spec, I just get an ugly traceback, e.g.:But, if I add
err.failedValidation = true;
to the error condition inindex.js
(I can create a pull request if necessary, but I'll comment with the code snippet), I get some useful output:I assume the nice output is the desired behavior ... will you publish a fix?
The text was updated successfully, but these errors were encountered: