rambler-digital-solutions / actix-web-validator

Rust library for providing validation mechanism to actix-web with Validator crate.
MIT License
101 stars 26 forks source link

Errors in JSON format #33

Open goshoo opened 2 years ago

goshoo commented 2 years ago

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.

singulared commented 2 years ago

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

goshoo commented 2 years ago

Hi @singulared,

thanks for the link!

singulared commented 2 years ago

@goshoo Can i close this issue?

goshoo commented 2 years ago

@singulared,

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

singulared commented 2 years ago

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

goshoo commented 2 years ago

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).

singulared commented 2 years ago

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

DenuxPlays commented 9 months ago

Any updates on this?