mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 21:43:02 +12:00
improvement: Update remaining builtin validators (#244)
Co-authored-by: David Culina <git@omnium.co>
This commit is contained in:
parent
35af220d9d
commit
dd1474a4f6
3 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ defmodule Ash.Resource.Validation.Match do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def validate(changeset, opts) do
|
def validate(changeset, opts) do
|
||||||
case Ash.Changeset.fetch_change(changeset, opts[:attribute]) do
|
case Ash.Changeset.fetch_argument_or_change(changeset, opts[:attribute]) do
|
||||||
{:ok, changing_to} ->
|
{:ok, changing_to} ->
|
||||||
case string_value(changing_to, opts) do
|
case string_value(changing_to, opts) do
|
||||||
{:ok, changing_to} ->
|
{:ok, changing_to} ->
|
||||||
|
|
|
@ -33,7 +33,7 @@ defmodule Ash.Resource.Validation.OneOf do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def validate(changeset, opts) do
|
def validate(changeset, opts) do
|
||||||
case Ash.Changeset.fetch_change(changeset, opts[:attribute]) do
|
case Ash.Changeset.fetch_argument_or_change(changeset, opts[:attribute]) do
|
||||||
{:ok, nil} ->
|
{:ok, nil} ->
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ defmodule Ash.Resource.Validation.StringLength do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def validate(changeset, opts) do
|
def validate(changeset, opts) do
|
||||||
case Ash.Changeset.get_attribute(changeset, opts[:attribute]) do
|
case Ash.Changeset.get_argument_or_attribute(changeset, opts[:attribute]) do
|
||||||
nil ->
|
nil ->
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue