Enforce request body match validation schema
See original GitHub issueHow to make sure the schema of the body is exactly of this form.
{
'name': ...
'description': ...
}
I mean if the body contains other fields than these (name
, description
), then I want to signal them by raising an exception.
Ex:
{
'name': 'Bob'
'description': 'Card player'
'age' : 54
}
In this case, the validation should fail because the field age
is not part of the wanted schema.
Obviously, it’s possible to create a custom task, but it would be a great asset to have this functionality in express-validator
. Some kind of matchSchema(true)
?
Duplicate of https://github.com/express-validator/express-validator/issues/1101#issuecomment-1112320481 but this issue has been closed.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Validate Request Body in RESTful Web Service
In this tutorial, you will learn how to validate the request body of an HTTP Post request sent to a RESTful Web Service...
Read more >Schema Validation in Go using Validator and Fiber
Now let's validate the request body and if there was any error, the request will not go to the next handler and the...
Read more >Validate request body separately from request as a whole
I do need it to be executed as long as part of the schema is correct (correct headers), and the body is an...
Read more >Using JSON Schema Validation with the AWS API Gateway
If you want to accept JSON payloads from POST requests that contain data created by your frontend client you may end up needing...
Read more >Enable request validation in API Gateway - AWS Documentation
Learn how to enable request validation on methods for API Gateway. You can validate a request body by specifying a model schema or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@erakis That’s integrated! You can chain that validation with all the others… As per deep validation, as I said, you just do some refactor using recursion… Here in Italy we say “Non esiste la pappa pronta”, which means you can’t find exactly what you need nice and ready to use 😃 Cheers
It would, just be sure to open and develop it against the v7-features branch!