elixir-maru / maru

Elixir RESTful Framework
https://maru.readme.io
BSD 3-Clause "New" or "Revised" License
1.32k stars 85 forks source link

🐛 Expanded options for validators to allow aliased modules #89

Closed nicooga closed 6 years ago

nicooga commented 6 years ago

Fixed https://github.com/elixir-maru/maru/issues/88.

Doing the "caller passing dance" again!

Modified Maru.Builder.Params.parse to take the caller and use it to expand the ast for options passed to param validators. This way we can use alias there.

Note: I've modified parse to accept 2 parameters, the caller being the last one. Although I've changed all the calls to parse/1 to use parse/2 and pass the caller, I was getting errors about some piece of code still wanting to call parse/1 which did not exist anymore. So I've defined parse/1 to proxy to parse/2 which "solved" the issue. This is a hack, I don't know who is still using parse/1 and even when the tests still pass I might have broken something.

falood commented 6 years ago

Thank you for pointing it out @nicooga I made another alternative pr, can we move to #91 to continue discussing?

nicooga commented 6 years ago

Closing in favor of https://github.com/elixir-maru/maru/pull/91