ash v1.24.1 Ash.Resource.Validation.Builtins View Source

Built in validations that are available to all resources

The functions in this module are imported by default in the validations section.

Link to this section Summary

Functions

Validates the absence of a list of attributes

Validates that an attribute's value is in a given list

Validates the presence of a list of attributes

Link to this section Functions

Link to this function

absent(attributes, opts \\ [])

View Source

Validates the absence of a list of attributes

If no options are provided, validates that they are all absent.

The docs behave the same as present/2, except they validate absence.

Link to this function

one_of(attribute, values)

View Source

Validates that an attribute's value is in a given list

Link to this function

present(attributes, opts \\ [])

View Source

Validates the presence of a list of attributes

If no options are provided, validates that they are all present.

  • :at_least - At least this many must be present. Defaults to the number of attributes provided

  • :at_most - At most this many must be present. Defaults to the number of attributes provided

  • :exactly - Exactly this many must be present