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

Feature Request: Put functions in the schema values #25

Open
SkipMike opened this issue Dec 22, 2017 · 1 comment
Open

Feature Request: Put functions in the schema values #25

SkipMike opened this issue Dec 22, 2017 · 1 comment

Comments

@SkipMike
Copy link

I love this library, but I almost never build my own changeset validation functions because it's too cumbersome. I usually just use with after using params validation for types.

However, I think that it would be awesome if we could put validation functions in the schema. Could we somehow detect those and build a changeset validation out of functions, as long as they have the right call signature?

defparams asdf %{
  x!: fn :x, x -> is_integer(x) and x > 0 end,
  y!: :string,
}

This would satisfy the other 20% of api validation that I need. I'm happy to take a stab at this, if you guys think that it's feasible and desirable.

@towhans
Copy link

towhans commented Jan 24, 2022

I'd be happy with functions as values in default:

Use case: auto-generate ids.

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