-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Request body is typed but not checked at runtime #902
Comments
I don't think this is related to those issues. It seems TypeBox validation doesn't work with regular JSON schemas. |
Still reproducible on |
As I said earlier, if you don't use TypeBox to build the schema, runtime validations won't be available. We did not want to embed an extta validation system like AJV which will considerably increase the bundle size. So if you want to have this, you need to use TypeBox. |
Thanks @ardatan for the prompt response! I inserted a few It would be great if such constraint is included in the Type-Safety & Validation document. The page only mentions about the validation and bad requests, but the description can hardly connect to TypeBox. |
- use typebox to verify inputs ardatan/feTS#902 (comment)
Describe the bug
It seems that the JSON schema given to
.route()
is purely informational despite what the documentation suggests:Running the following code will not return a server error:
To Reproduce Steps to reproduce the behavior:
https://stackblitz.com/edit/stackblitz-starters-zhnkw4?file=index.ts
Run
yarn fetch
in another terminal :Expected behavior
I'm expecting the request to fail with a 400 Bad Request error
Environment:
Additional context
The text was updated successfully, but these errors were encountered: