Ash FrameworkAF
Ash Framework5mo ago
14 replies
minib

AshPhoenix - Union: "is not a map" error

I can't figure out why these params don't work:

%{
  "access" => %{
    "_form_type" => "create",
    "_persistent_id" => "0",
    "_touched" => "_form_type,_persistent_id,_touched,_union_type,_unused_api_key,_unused_secret_key,api_key,secret_key",
    "_union_type" => "xyz",
    "api_key" => "dsf",
    "secret_key" => "sdf"
  },
  "account_id" => "0198dd77-e6cb-7d4c-a039-9e128da2ea8f",
  "label" => "asd"
}


This is the failed form:

  source: #AshPhoenix.Form<
    action: :create,
    params: %{
      "access" => %Ash.Union{value: nil, type: :xyz},
      "account_id" => "0198dd77-e6cb-7d4c-a039-9e128da2ea8f",
      "label" => "asd"
    },
    raw_params: %{
      "access" => %{
        "_form_type" => "create",
        "_persistent_id" => "0",
        "_touched" => "_form_type,_persistent_id,_touched,_union_type,_unused_api_key,_unused_secret_key,api_key,secret_key",
        "_union_type" => "xyz",
        "api_key" => "dsf",
        "secret_key" => "sdf"
      },
      "account_id" => "0198dd77-e6cb-7d4c-a039-9e128da2ea8f",
      "label" => "asd"
    },  
  params: %{
    "access" => %Ash.Union{value: nil, type: :xyz},
    "account_id" => "0198dd77-e6cb-7d4c-a039-9e128da2ea8f",
    "label" => "asd"
  },
  errors: [access: {"is not a map", []}],


Can anyone please help me to debug?
Was this page helpful?