(CompileError) 无效的引用表达式

(CompileError) invalid quoted expression

我被难住了trying to debug this

我正在尝试将 elixir 从 1.7 升级到 1.13 以及一些依赖项。我逐渐增加了版本以达到这一点。

任何人都知道 absinthe does scalars?

方面的任何重大变化

related question。不过,他们给出的示例并不适合初学者。

escape docs

quote docs

== Compilation error in file lib/ellie_web/graphql/types/elm/docs.ex ==
** (CompileError) lib/ellie_web/graphql/types/elm/docs.ex: invalid quoted expression: %Absinthe.Blueprint.TypeReference.NonNull{errors: [], of_type: %Absinthe.Blueprint.TypeReference.List{errors: [], of_type: %Absinthe.Blueprint.TypeReference.NonNull{errors: [], of_type: {:type, [line: 4], nil}}}}

Please make sure your quoted expressions are made of valid AST nodes. If you would like to introduce a value into the AST, such as a four-element tuple or a map, make sure to call Macro.escape/1 before
    (absinthe 1.7.0) expanding macro: Absinthe.Schema.Notation.non_null/1
    lib/ellie_web/graphql/types/elm/docs.ex:4: EllieWeb.Graphql.Types.Elm.Docs.good_list/1
make: *** [bootstrap] Error 1




%Absinthe.Blueprint.TypeReference.NonNull{
    errors: [],
    of_type: %Absinthe.Blueprint.TypeReference.List{
        errors: [],
        of_type: %Absinthe.Blueprint.TypeReference.NonNull{
            errors: [],
            of_type: {:type, [line: 4], nil}
        }
    }
}

[1]

  scalar :elm_docs_type, name: "ElmDocsType" do
    serialize fn string -> string end

    parse fn
      %Absinthe.Blueprint.Input.String{value: value} -> {:ok, value}
      %Absinthe.Blueprint.Input.Null{}               -> {:ok, nil}
      _                                              -> :error
    end
  end

[2]


  scalar :elm_docs_type, name: "ElmDocsType" do
    serialize(&encode/1) 
    parse(&decode/1)
  end
  @spec decode(Absinthe.Blueprint.Input.String.t()) :: {:ok, term()} | :error
  @spec decode(Absinthe.Blueprint.Input.Null.t()) :: {:ok, nil}
  defp decode(%Absinthe.Blueprint.Input.String{value: value}) do
    {:ok, value}
  end

  defp decode(%Absinthe.Blueprint.Input.Null{}) do
    {:ok, nil}
  end

  defp decode(_) do
    :error
  end

  defp encode(value) do
    value
  end
$ cat mix.exs
...
  defp deps do
    [
      {:absinthe, "1.7.0"},
      {:absinthe_plug, "1.5.8"},
      {:absinthe_phoenix, "2.0.2"},
      {:combine, "~> 0.10"},
      {:cowboy, "~> 2.4"},
      {:dataloader, "~> 1.0.0"},
      {:distillery, "~> 2.0.10"},
      {:httpoison, "~> 1.1"},
      {:murmur, "~> 1.0"},
      {:phoenix, "~> 1.6.7"},
      {:phoenix_pubsub, "~> 2.1.1"},
      {:phoenix_ecto, "~> 4.4.0"},
      {:reverse_proxy_plug, "~> 2.1"},
      {:ecto_sql, "~> 3.0"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 3.0.0"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:phoenix_markdown, "~> 1.0"},
      {:poison, "~> 3.1"},
      {:porcelain, "~> 2.0.3"},
      {:quantum, "~> 2.2"},
      {:timex, "~> 3.0"},
      {:sweet_xml, "~> 0.6"},
      {:sentry, "~> 7.0.6"}
    ]
  end

这个差异成功了。 defp

似乎有问题
-  defp good_list(type), do: non_null(list_of(non_null(type)))
-
   object :elm_docs_module do
     field :name, non_null(:string)
     field :comment, non_null(:string)
-    field :unions, good_list(:elm_docs_union)
-    field :aliases, good_list(:elm_docs_alias)
-    field :values, good_list(:elm_docs_value)
-    field :binops, good_list(:elm_docs_binop)
+    field :unions, non_null(list_of(non_null(:elm_docs_union)))
+    field :aliases, non_null(list_of(non_null(:elm_docs_alias)))
+    field :values, non_null(list_of(non_null(:elm_docs_value)))
+    field :binops, non_null(list_of(non_null(:elm_docs_binop)))
   end