actix-web-validator icon indicating copy to clipboard operation
actix-web-validator copied to clipboard

Errors in JSON format

Open goshoo opened this issue 2 years ago • 8 comments

Hi,

this is a feature request.

is it possible somehow users to be able to configure format for validation errors. Now the only format is plain text but I would like JSON format to be an option as well.

goshoo avatar Jun 29 '22 09:06 goshoo

Hi, @goshoo you may use custom error handler for this case https://github.com/rambler-digital-solutions/actix-web-validator/issues/20#issuecomment-856078177

singulared avatar Jul 03 '22 13:07 singulared

Hi @singulared,

thanks for the link!

goshoo avatar Jul 09 '22 18:07 goshoo

@goshoo Can i close this issue?

singulared avatar Jul 15 '22 10:07 singulared

@singulared,

sure, but I think that it'll be a good idea this possibility for custom error handler to be documented somewhere.

goshoo avatar Jul 15 '22 12:07 goshoo

@goshoo Yep, I think it should be optional. But I don't understand what structure it should have for now.

singulared avatar Jul 15 '22 14:07 singulared

Maybe it should be a unique list of fields which have errors (hash table) and every value for every field should be an array of error messages ( vector of Strings).

goshoo avatar Jul 15 '22 14:07 goshoo

I am thinking about another actix-web errors. Ok, I will try implement something with fixed structure on this weekend.

singulared avatar Jul 15 '22 14:07 singulared

Any updates on this?

DenuxPlays avatar Jan 19 '24 07:01 DenuxPlays