Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Episode 123 - Ecto for param validation #44

Open
akoutmos opened this issue Sep 20, 2018 · 0 comments

Comments

@akoutmos
Copy link

commented Sep 20, 2018

Let me start by saying as a long time listener I love the podcast and appreciate what you guys are doing!

In regards to the "Ecto!" episode, I also very much like the pattern of creating embedded schemas for endpoint param validation and then creating a plug in my controller to validate that the params coming in passed the changeset validations. The problem was, there was a TON of boilerplate that had to be copy and pasted every time I wanted to do this for every endpoint and quickly got messy.

There exists the params library (https://github.com/vic/params) but unfortunately all the library does is ensure the request payload matches the defined schema in terms of required/optional and type. So I created my own library on top of Ecto schemas :).

The library is published and on hex (https://hex.pm/packages/pharams) and the code is up on github (https://github.com/akoutmos/pharams). It's still very early on in its development, but for the most part it works great and cuts down the boilerplate considerably. Would be interested in getting feedback/input and hopefully it is useful to other people for param validation in Phoenix.

Thanks again for the podcast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.