phx.gen.live can not generate array of enums
hamir-suspect opened this issue · 0 comments
hamir-suspect commented
Environment
- Elixir version (elixir -v): Elixir 1.17.0 (compiled with Erlang/OTP 25)
- Phoenix version (mix deps):
* bandit 1.5.7 (Hex package) (mix)
locked at 1.5.7 (bandit) f2dd92ae
ok
* bcrypt_elixir 3.1.0 (Hex package) (mix)
locked at 3.1.0 (bcrypt_elixir) 2ad2acb5
ok
* castore 1.0.8 (Hex package) (mix)
locked at 1.0.8 (castore) 0b2b66d2
ok
* comeonin 5.4.0 (Hex package) (mix)
locked at 5.4.0 (comeonin) 796393a9
ok
* db_connection 2.7.0 (Hex package) (mix)
locked at 2.7.0 (db_connection) dcf08f31
ok
* decimal 2.1.1 (Hex package) (mix)
locked at 2.1.1 (decimal) 53cfe5f4
ok
* dns_cluster 0.1.3 (Hex package) (mix)
locked at 0.1.3 (dns_cluster) 46cb7c4a
ok
* ecto 3.12.2 (Hex package) (mix)
locked at 3.12.2 (ecto) 492e67c7
ok
* ecto_sql 3.12.0 (Hex package) (mix)
locked at 3.12.0 (ecto_sql) dc9e4d20
ok
* elixir_make 0.8.4 (Hex package) (mix)
locked at 0.8.4 (elixir_make) 6e7f1d61
ok
* esbuild 0.8.1 (Hex package) (mix)
locked at 0.8.1 (esbuild) 25fc876a
ok
* expo 1.0.1 (Hex package) (mix)
locked at 1.0.1 (expo) f250b332
ok
* file_system 1.0.1 (Hex package) (mix)
locked at 1.0.1 (file_system) 4414d1f3
ok
* finch 0.18.0 (Hex package) (mix)
locked at 0.18.0 (finch) 69f5045b
ok
* gettext 0.26.1 (Hex package) (mix)
locked at 0.26.1 (gettext) 01ce56f1
ok
* heroicons (https://github.com/tailwindlabs/heroicons.git - v2.1.1)
locked at 88ab3a0 (tag: v2.1.1)
ok
* hpax 1.0.0 (Hex package) (mix)
locked at 1.0.0 (hpax) 7f131473
ok
* jason 1.4.4 (Hex package) (mix)
locked at 1.4.4 (jason) c5eb0cab
ok
* mime 2.0.6 (Hex package) (mix)
locked at 2.0.6 (mime) c9945363
ok
* mint 1.6.2 (Hex package) (mix)
locked at 1.6.2 (mint) 5ee441df
ok
* nimble_options 1.1.1 (Hex package) (mix)
locked at 1.1.1 (nimble_options) 821b2470
ok
* nimble_pool 1.1.0 (Hex package) (mix)
locked at 1.1.0 (nimble_pool) af2e4e6b
ok
* phoenix 1.7.14 (Hex package) (mix)
locked at 1.7.14 (phoenix) c7859bc5
ok
* phoenix_ecto 4.6.2 (Hex package) (mix)
locked at 4.6.2 (phoenix_ecto) 3f94d025
ok
* phoenix_html 4.1.1 (Hex package) (mix)
locked at 4.1.1 (phoenix_html) f2f2df5a
ok
* phoenix_live_dashboard 0.8.4 (Hex package) (mix)
locked at 0.8.4 (phoenix_live_dashboard) 2984aae9
ok
* phoenix_live_reload 1.5.3 (Hex package) (mix)
locked at 1.5.3 (phoenix_live_reload) b4ec9cd7
ok
* phoenix_live_view 1.0.0-rc.6 (Hex package) (mix)
locked at 1.0.0-rc.6 (phoenix_live_view) e56e4f16
ok
* phoenix_pubsub 2.1.3 (Hex package) (mix)
locked at 2.1.3 (phoenix_pubsub) bba06bc1
ok
* phoenix_template 1.0.4 (Hex package) (mix)
locked at 1.0.4 (phoenix_template) 2c0c81f0
ok
* plug 1.16.1 (Hex package) (mix)
locked at 1.16.1 (plug) a13ff6b9
ok
* plug_crypto 2.1.0 (Hex package) (mix)
locked at 2.1.0 (plug_crypto) 131216a4
ok
* postgrex 0.19.1 (Hex package) (mix)
locked at 0.19.1 (postgrex) 8bac7885
ok
* swoosh 1.16.12 (Hex package) (mix)
locked at 1.16.12 (swoosh) 0e262df1
ok
* tailwind 0.2.3 (Hex package) (mix)
locked at 0.2.3 (tailwind) 8e45e7a3
ok
* telemetry 1.3.0 (Hex package) (rebar3)
locked at 1.3.0 (telemetry) 7015fc89
ok
* telemetry_metrics 1.0.0 (Hex package) (mix)
locked at 1.0.0 (telemetry_metrics) f23713b3
ok
* telemetry_poller 1.1.0 (Hex package) (rebar3)
locked at 1.1.0 (telemetry_poller) 9eb9d9cb
ok
* thousand_island 1.3.5 (Hex package) (mix)
locked at 1.3.5 (thousand_island) 2be69549
ok
* websock 0.5.3 (Hex package) (mix)
locked at 0.5.3 (websock) 6105453d
ok
* websock_adapter 0.5.7 (Hex package) (mix)
locked at 0.5.7 (websock_adapter) d0f478ee
ok
- Operating system: macOS 14.6.1 (23G93)
Actual behavior
When using mix phx.gen.live
to generate a schema it is not possible to have array of enums. Example below:
mix phx.gen.live Tests Testy testy numbers:array:enum:one:two:three
** (Mix) Unknown type `numbers:enum:one:two:three` given to generator
This is the full output, printed out by this function.
Expected behavior
I'd like to see the correct schema being generated, the field should look like:
field :numbers, {:array, Ecto.Enum}, values: :one, :two, :three
but I understand that it's not easy generating code, even the current implementation is magical and does not take much adaptation to go from array:string to enums, thanks.