Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support union types #145

Closed
revati opened this issue May 9, 2024 · 1 comment
Closed

Support union types #145

revati opened this issue May 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@revati
Copy link
Contributor

revati commented May 9, 2024

Describe the bug
Union types are not rendered as inputs in form

To Reproduce

defmodule Resource.PathElement do
  use Ash.Type.NewType,
    subtype_of: :union,
    constraints: [
      types: [
        integer: [type: :integer],
        string: [type: :string]
      ]
    ]
end

Expected behavior
Have input

Runtime

  • Ash admin version: 0.10.10-rc.1

Additional context

[error] GenServer #PID<0.5962.0> terminating
** (RuntimeError) Got no "_union_type" parameter, and no union type had a tag & tag_value pair matching the params.

If you are adding a form, select a type using params: %{"_union_type" => "type_name"}, or if one
or more of your types is using a tag you can set that tag with params: %{"tag" => "tag_value"}.

Params:

nil

Available types:

[integer: [type: :integer], string: [type: :string]]

(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/auto.ex:263: AshPhoenix.Form.Auto.determine_type/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/auto.ex:155: anonymous fn/5 in AshPhoenix.Form.Auto.unions/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:3156: AshPhoenix.Form.update_opts/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1213: anonymous fn/9 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1210: anonymous fn/7 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1058: AshPhoenix.Form.validate/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1279: anonymous fn/9 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1210: anonymous fn/7 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1058: AshPhoenix.Form.validate/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1279: anonymous fn/9 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1210: anonymous fn/7 in AshPhoenix.Form.validate_nested_forms/6
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:1058: AshPhoenix.Form.validate/3
(ash_phoenix 2.0.0-rc.8) lib/ash_phoenix/form/form.ex:985: AshPhoenix.Form.validate/3
(ash_admin 0.10.10-rc.1) lib/ash_admin/components/resource/form.ex:1275: AshAdmin.Components.Resource.Form.handle_event/3
@revati revati added the bug Something isn't working label May 9, 2024
@revati
Copy link
Contributor Author

revati commented May 12, 2024

Related to #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant