@@ -13,14 +13,14 @@ defmodule AshRandomParams.Transformer do
1313 def add_random_params ( dsl_state ) do
1414 action = Builder . build_action_argument ( :action , :atom , default: :create )
1515 init_params = Builder . build_action_argument ( :init_params , :map , default: % { } )
16- fill = Builder . build_action_argument ( :fill , { :array , :atom } , default: [ ] )
17- unfill = Builder . build_action_argument ( :unfill , { :array , :atom } , default: [ ] )
16+ populate = Builder . build_action_argument ( :populate , { :array , :atom } , default: [ ] )
17+ omit = Builder . build_action_argument ( :omit , { :array , :atom } , default: [ ] )
1818 keep_defaults? = Builder . build_action_argument ( :keep_defaults? , :boolean , default: true )
1919
2020 dsl_state
2121 |> Builder . add_action ( :action , :random_params ,
2222 returns: :map ,
23- arguments: [ action , init_params , unfill , fill , keep_defaults? ] ,
23+ arguments: [ action , init_params , omit , populate , keep_defaults? ] ,
2424 run: & __MODULE__ . do_random_params / 2
2525 )
2626 |> Builder . add_interface ( :random_params , args: [ :action , { :optional , :init_params } ] )
@@ -44,8 +44,8 @@ defmodule AshRandomParams.Transformer do
4444 arguments: % {
4545 action: action ,
4646 init_params: init_params ,
47- unfill: unfill ,
48- fill: fill ,
47+ omit: omit ,
48+ populate: populate ,
4949 keep_defaults?: keep_defaults?
5050 }
5151 } =
@@ -86,7 +86,7 @@ defmodule AshRandomParams.Transformer do
8686 |> Enum . reject ( & ( & 1 . name in belongs_to_attrs ) )
8787 end
8888 end )
89- |> Enum . reject ( & ( & 1 . name in unfill ) )
89+ |> Enum . reject ( & ( & 1 . name in omit ) )
9090 |> Enum . reject ( & ( & 1 . name in init_keys ) )
9191 |> Map . new ( fn % { name: name , default: default } ->
9292 value =
@@ -109,16 +109,16 @@ defmodule AshRandomParams.Transformer do
109109 { random_mod , random_opts } =
110110 random = AshRandomParams.Info . random_params_random! ( input . resource )
111111
112- fields_by_unfill =
112+ fields_by_omit =
113113 candidates
114114 |> Enum . reject ( & ( & 1 . name in rel_names ) )
115115 |> Enum . reject ( & ( & 1 . name in belongs_to_attrs ) )
116- |> Enum . reject ( & ( & 1 . name in unfill ) )
116+ |> Enum . reject ( & ( & 1 . name in omit ) )
117117 |> Enum . reject ( & & 1 . allow_nil? )
118118
119- fields_by_fill = candidates |> Enum . filter ( & ( & 1 . name in fill ) )
119+ fields_by_fill = candidates |> Enum . filter ( & ( & 1 . name in populate ) )
120120
121- ( fields_by_unfill ++ fields_by_fill )
121+ ( fields_by_omit ++ fields_by_fill )
122122 |> Enum . reject ( & ( & 1 . name in init_keys ) )
123123 |> Map . new ( fn % { name: name , default: default } = attr_or_arg ->
124124 value =
0 commit comments