ekosz
Reactor not recognizing inputs transform?
Hi there, I have the following Reactor code:
defmodule CreateNewAccount do
use Reactor, extensions: [Ash.Reactor]
alias Accounts.Account
ash do
default_domain Accounts
end
input(:email)
input(:email_is_verified?)
create :account, Account do
inputs %{
email: input(:email),
email_is_verified?: input(:email_is_verified?)
} do
transform(fn input ->
input
|> Map.drop([:email_is_verified?])
|> Map.put(
:email_verified_at,
if input[:email_is_verified] do
nil
else
DateTime.now()
end
)
end)
end
end
end
But I’m getting the following error
Compiling 2 files (.ex)
== Compilation error in file lib/create_new_account.ex ==
** (Spark.Error.DslError) [CreateNewAccount]
reactor -> create -> account:
The create step `:account refers to an input named `email_is_verified?` which doesn't exist.
Did you mean `updated_at`, `created_at`, `id`, `email` or `email_verified_at`?
Looks like the DSL isn’t recognizing that I’m transforming the input. Is this a bug or am I just doing something incorrect?
Thank you!
Most Liked Responses
jimsynz
Ash Core Team
Yeah that makes sense. We can’t validate the keys statically if the input is being transformed. @ekosz do you mind opening an issue on ash (it’s an Ash.Reactor bug) and I’ll tackle it once I am back from my holiday. In the mean time you can move that behaviour into a change on the underlying action or process it as a seperate step so that the input map has the correct keys.
3
Popular in Questions
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)?
Would
mix ecto.rollback -v 200809061...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
I have a super simple question about elixir - how would I take a file like this
foo
bar
baz
and output a new file that enumerates th...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
I would like to know what is the best IDE for elixir development?
New
Other popular topics
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
Hello, how can I check the Phoenix version ?
Thanks !
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hello everyone,
Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Lets say i have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => "XXX...
New








