CargoSense / vex

Data Validation for Elixir
MIT License
595 stars 60 forks source link

Allow returning message text with parameters #27

Closed hubertlepicki closed 7 years ago

hubertlepicki commented 8 years ago

I am uncertain if this is helpful for other prople, but let's see what you guys think.

I have an app that performs validations using Vex. The app is divided into API and front-end. API returns error messages that I want to run through gettext (i18next to be precise) on client side.

This patch allows disabling EEX processing of validation messages, and let user decide what they want to do with it. In my case, I am replacing them with custom error messages and send down to client through an API. But I can imagine there may be other use cases as well.

You can globally disable EEX processing in confing, or decide on individual validations.

djspinmonkey commented 8 years ago

This looks great to me, @hubertlepicki. If you fix the merge conflict, I will merge and push a release. If you don't have time right now, no problem, and I'll probably get to it myself in a week or two (I have a busy time coming up starting tomorrow).