You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's awesome swaggerize-express validates incoming requests against the swagger schema. But I was wondering, how can I customise the response in not returning HTML formatted response, but a JSON response when validation fails?
Regards.
The text was updated successfully, but these errors were encountered:
The validation is done in a middleware function in the route system. It simply calls the next one with an error if it finds anything. This is the standard express way.
For example, if your api is under /api - add this as the last route declared:
app.use('/api', (err, req, res, next) => {
res.status(err.status).json(err);
});
Hi guys,
Small (noob) question about swaggerize-express
It's awesome swaggerize-express validates incoming requests against the swagger schema. But I was wondering, how can I customise the response in not returning HTML formatted response, but a JSON response when validation fails?
Regards.
The text was updated successfully, but these errors were encountered: