params
params copied to clipboard
Feature Request: Put functions in the schema values
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.
I'd be happy with functions as values in default:
Use case: auto-generate ids.