ash-project / ash_phoenix

Utilities for integrating Ash and Phoenix

Home Page:https://hexdocs.pm/ash_phoenix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mix ash_phoenix.gen.live Error

dewetblomerus opened this issue · comments

Describe the bug
I ran mix ash_phoenix.gen.live and got a syntax error on the generated code.

mix ash_phoenix.gen.live Red.Api Red.Api.Attempt

Compiling 1 file (.ex)
warning: the Inspect protocol has already been consolidated, an implementation for Red.Api.User has no effect. If you want to implement protocols after compilation or during tests, check the "Consolidation" section in the Protocol module documentation
  lib/red/api/resources/user.ex:1

warning: the Inspect protocol has already been consolidated, an implementation for Red.Api.User has no effect. If you want to implement protocols after compilation or during tests, check the "Consolidation" section in the Protocol module documentation
  lib/red/api/resources/user.ex:1

Would you like to name your actor? For example: `current_user`. If you choose no, we will not add any actor logic. [Yn] y
What would you like to name it? For example: `current_user` current_user
Please provide a plural_name. For example the plural of tweet is tweets.
You can press enter to abort, and then configure one on the resource, for example:

    resource do
      plural_name "tweets"
    end
> attempts
Primary destroy action not found, and a destroy action not supplied. Would you like to create one? [Yn] n
** (SyntaxError) lib/red_web/live/attempt_live/index.ex:80:96: unexpected token: }

    HINT: the "(" on line 80 is missing terminator ")"

    |
 80 |       |> assign(:attempt, Red.Api.get!(Red.Api.Attempt, id, actor: socket.assigns.current_user)})
    |                                                                                                ^
    (elixir 1.15.4) lib/code.ex:945: Code.format_string!/2
    (mix 1.15.4) lib/mix/tasks/format.ex:597: Mix.Tasks.Format.elixir_format/2
    (ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:162: AshPhoenix.Gen.Live.write_formatted_template/5
    (ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:97: AshPhoenix.Gen.Live.generate/3
    (mix 1.15.4) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.4) lib/mix/cli.ex:92: Mix.CLI.run_task/2
    /Users/dewet/.asdf/installs/elixir/1.15.4-otp-26/bin/mix:2: (file)

To Reproduce
I have a very minimal starter app here https://github.com/dewetblomerus/red

Expected behavior
It should generate code

Runtime

  • Elixir version 1.15.4
  • Erlang version 26
  • OS MacOs
  • Ash version 2.14.20
  • AshPhoenix version 1.2.17
  • any related extension versions

Additional context
Even if I did something wrong, there should never be a syntax error in generated code.

This was fixed in 1.2.18 :)