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
Hey,
I've been using swaggerize-express to deliver an API for over a year on a rapidly changing product with various frontend clients and developers coming and going. The number one enquiry I get is regarding a scenario where they have to make a POST/PATCH request with a body and made the mistake of not setting the Content-Type header correctly.
Due to the solid validation error responses generated by swaggerize-express based on my model definitions they can usually solve validation errors like these on their own. However, in the case of a bad Content-Type the validation error states that the body is missing or rather "<name-of-body-parameter>" is required. Since I have worked with this backend for a while I know to check the Content-Type, but to a new API consumer this is not obvious.
I have attempted to set the "consumes" attribute in my swagger file, but the error response remains unchanged. Is there any nice way to deliver a more accurate error message using the Swagger definition or will we have to put together some custom validation middleware checking the Content-Type?
The text was updated successfully, but these errors were encountered:
Hey,
I've been using swaggerize-express to deliver an API for over a year on a rapidly changing product with various frontend clients and developers coming and going. The number one enquiry I get is regarding a scenario where they have to make a POST/PATCH request with a body and made the mistake of not setting the Content-Type header correctly.
Due to the solid validation error responses generated by
swaggerize-express
based on my model definitions they can usually solve validation errors like these on their own. However, in the case of a bad Content-Type the validation error states that the body is missing or rather"<name-of-body-parameter>" is required
. Since I have worked with this backend for a while I know to check the Content-Type, but to a new API consumer this is not obvious.I have attempted to set the
"consumes"
attribute in my swagger file, but the error response remains unchanged. Is there any nice way to deliver a more accurate error message using the Swagger definition or will we have to put together some custom validation middleware checking the Content-Type?The text was updated successfully, but these errors were encountered: