From bc05fb5b4746547208ddf0fc27620973b9309f43 Mon Sep 17 00:00:00 2001 From: zimt28 <1764689+zimt28@users.noreply.github.com> Date: Mon, 18 Jul 2022 21:22:17 +0200 Subject: [PATCH] Deprecate option type helper (#352) --- lib/ash/options_helpers.ex | 1 + lib/ash/resource/actions/shared_options.ex | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ash/options_helpers.ex b/lib/ash/options_helpers.ex index 99975dc3..e6763b62 100644 --- a/lib/ash/options_helpers.ex +++ b/lib/ash/options_helpers.ex @@ -143,6 +143,7 @@ defmodule Ash.OptionsHelpers do def map(value) when is_map(value), do: {:ok, value} def map(_), do: {:error, "must be a map"} + @deprecated "Use {:list, :atom} instead" def list_of_atoms(value) do if is_list(value) and Enum.all?(value, &is_atom/1) do {:ok, value} diff --git a/lib/ash/resource/actions/shared_options.ex b/lib/ash/resource/actions/shared_options.ex index b4c553e2..47e7bea6 100644 --- a/lib/ash/resource/actions/shared_options.ex +++ b/lib/ash/resource/actions/shared_options.ex @@ -38,11 +38,11 @@ defmodule Ash.Resource.Actions.SharedOptions do @create_update_opts [ accept: [ - type: {:custom, Ash.OptionsHelpers, :list_of_atoms, []}, + type: {:list, :atom}, doc: "The list of attributes to accept. Defaults to all attributes on the resource" ], reject: [ - type: {:custom, Ash.OptionsHelpers, :list_of_atoms, []}, + type: {:list, :atom}, doc: """ A list of attributes not to accept. This is useful if you want to say 'accept all but x' @@ -51,7 +51,7 @@ defmodule Ash.Resource.Actions.SharedOptions do """ ], require_attributes: [ - type: {:custom, Ash.OptionsHelpers, :list_of_atoms, []}, + type: {:list, :atom}, doc: """ A list of attributes that would normally `allow_nil` to require for this action.