ash-project / ash_json_api

The JSON:API extension for the Ash Framework
https://hexdocs.pm/ash_json_api
MIT License
56 stars 40 forks source link

Version 0.32.0 causes Elixir compile error with OTP 25 and Elxir 1.14.1 #86

Closed tommasop closed 8 months ago

tommasop commented 1 year ago

Describe the bug

Error: ** (CompileError) elixir_compiler_18:1: function '-__MODULE__/1-fun-2-'/5+6:
  Internal consistency check failed - please report this bug.
  Instruction: {get_map_elements,
                   {f,57},
                   {x,0},
                   {list,
                       [{atom,route},
                        {x,9},
                        {atom,relationship},
                        {x,8},
                        {atom,method},
                        {x,7},
                        {atom,controller},
                        {x,6},
                        {atom,action_type},
                        {x,6},
                        {atom,action},
                        {x,5}]}}
  Error:       conflicting_destinations:

    (stdlib 4.0.1) lists.erl:1442: :lists.foreach_1/2
Error: Process completed with exit code 1.

To Reproduce This happens with the following code:

defmodule MmsBiztalkWeb.Plugs.MmsBiztalkApi do
  use AshJsonApi.Api.Router,
    # Your Ash.Api Module
    api: MmsBiztalk,
    # Your Ash.Registry Module
    registry: MmsBiztalk.Registry,
    json_schema: "/schema",
    open_api: "/open_api",
    modify_open_api: {__MODULE__, :modify_open_api, []}

  def modify_open_api(spec, _, _) do
    %{
      spec
      | info: %{
          spec.info
          | title: "Biztalk JSON API",
            version: Application.get_env(:mms_biztalk, :version)
        }
    }
  end
end

Expected behavior It should compile as happens with v. 0.31.3

** Runtime

zachdaniel commented 8 months ago

This looks like a bug with Elixir or Erlang to me.