View Source Ash.Resource.Validation behaviour (ash v2.9.11)
Represents a validation in Ash.
See Ash.Resource.Validation.Builtins
for a list of builtin validations.
To write your own validation, define a module that implements the init/1
callback
to validate options at compile time, and validate/2
callback to do the validation.
Then, in a resource, you can say:
validations do
validate {MyValidation, [foo: :bar]}
end
Link to this section Summary
Link to this section Types
Link to this section Callbacks
@callback validate(Ash.Changeset.t(), Keyword.t()) :: :ok | {:error, term()}