mobeen
mobeen

Reputation: 188

how to apply validation to a api request in symfony4

i want to validate the request and send error messages and send error messages of each field in symfony. Is that possible ?

Upvotes: 0

Views: 88

Answers (1)

P.Prochaska
P.Prochaska

Reputation: 49

You can do it like in this https://symfony.com/doc/current/validation/raw_values.html.

Or you can use FOSRestBundle. With this bundle you can use the ParamConverter with a validator option and then the errors will be injected to your controller.

Upvotes: 1

Related Questions