-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
The validation doesn't work at all #870
Comments
Your setup seems to be fine. Could you provide your apiSpec? |
Do you have any URLs set under the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I am trying to implement the express-openapi-validator in a sample node.js app.
I followed the instructions in the docs and configured it properly.
However, protected routes, which receive user input that must be validated are open for all - one can access them even without providing any input or do provide input which is invalid.
To Reproduce
Send an HTTP Request to the backend, with any input you like and it will work.
I protected in my specification the POST /persons route.
Actual behavior
Protected routes are never validating user inputs.
Expected behavior
There should be an error with a very detailed description that will be catch by the express error middleware.
Examples and context
This is the backend app code:
In the Swagger UI it seems that the POST /persons route is requiring
firstName
andlastName
with type of string and min 2 and max 20 length, each.By the way, if anyone post an answer or a fix for this, it can be great if you provide a a TypeScript sample node app which supports ESM, I used commonjs here since __dirname causes issues with TypeScript.
The text was updated successfully, but these errors were encountered: