ash v1.25.1 Ash.Resource.Dsl.Validate View Source

Link to this section Summary

Functions

Declares a validation for creates and updates.

Link to this section Functions

Link to this macro

validate(validation, opts \\ [])

View Source (macro)

Declares a validation for creates and updates.

Examples

validate {Mod, [foo: :bar]}
validate at_least_one_of_present([:first_name, :last_name])

Arguments

  • :validation - The module/opts pair of the validation

Options

  • :on - The action types the validation should run on.

Many validations don't make sense in the context of deletion, so by default it is left out of the list. The default value is [:create, :update].

  • :expensive? - If a validation is expensive, it won't be run on invalid changes. All inexpensive validations are always run, to provide informative errors. The default value is false.

  • :description - An optional description for the validation