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

Option for adding custom validation codes #50

Open
MartinElvar opened this issue Jul 17, 2019 · 3 comments
Open

Option for adding custom validation codes #50

MartinElvar opened this issue Jul 17, 2019 · 3 comments

Comments

@MartinElvar
Copy link

What problem does this feature solve?

Currently all custom changeset results in ecto.changeset.unknow, which is problematic to make sense for a client.

What is your proposed solution?

A solution could be to add a custom module, that straw_hat will try and match validation errors against.

@yordis
Copy link
Contributor

yordis commented Jul 17, 2019

@MartinElvar do you need help with this or could you make a PR? Otherwise, just add some example code on how you would like the API to look like.

@yordis
Copy link
Contributor

yordis commented Jul 17, 2019

Btw quick question,

Are you using one of these https://github.com/straw-hat-team/straw_hat/blob/a892754ac67568d4c6d7eb77fd83ceac5098a767/lib/straw_hat/error/changeset_parser.ex#L56-L60 ?

Because I remember that we should add either validation or constraint key to the custom error.

I fixed this in Ecto and we should encourage adding that key to libraries and definitely add it if you control the code.

@yordis
Copy link
Contributor

yordis commented Dec 14, 2020

@MartinElvar is this still relevant to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants