Skip to content
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

Unsupported content type validation error #128

Open
nielssj opened this issue Jul 25, 2017 · 0 comments
Open

Unsupported content type validation error #128

nielssj opened this issue Jul 25, 2017 · 0 comments

Comments

@nielssj
Copy link

nielssj commented Jul 25, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant