-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to integrate client request validation #2365
Comments
@bajtos thoughts? |
Joi is another option. How can Joi be used with LB4? @hacksparrow |
Thanks for the input @adesege, we are taking a looking at how to most optimally use these object validation libraries with LB4. |
|
Hi @bajtos and @hacksparrow , thank you for the response. Can you help with an example of how to use OpenApi for request validation? I have tried looking into the documentation but couldn't find any. Thanks |
@adesege You can find some example in our document regarding validation: https://loopback.io/doc/en/lb4/Parsing-requests.html#validation |
Thanks for the share @jannyHou |
I discovered that partially checking is handled on type and required fields of a model in @Property decorator. But more deep validation (for example length or format) is not supported out of the box. I think the alternative now is hapijs joi |
How can I implement express-validator library for client request validation (json)?
In express I used like:
[app.js]
app.use(expressValidator());
[routes/auth.js]
router.post('/login', controller.validate('login'), controller.login);
[controllers/auth.js]
The text was updated successfully, but these errors were encountered: