diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index ceee8548ee..02eca3ce1d 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -18,13 +18,10 @@ jobs: - '1.16' - '1.17' otp: - - '24' - '25' - '26' - '27' exclude: - - otp: 24 - elixir: 1.17 - otp: 25 elixir: 1.17 - otp: 27 @@ -42,16 +39,16 @@ jobs: elixir-version: ${{ matrix.elixir }} otp-version: ${{ matrix.otp }} - # - name: Restore deps cache - # uses: actions/cache@v2 - # with: - # path: | - # deps - # _build - # key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }} - # restore-keys: | - # deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} - # deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} + - name: Restore deps cache + uses: actions/cache@v2 + with: + path: | + deps + _build + key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }} + restore-keys: | + deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} - name: Install package dependencies run: mix deps.get @@ -61,25 +58,25 @@ jobs: - name: Run unit tests run: | - MIX_ENV=test mix clean - mix test + mix clean + mix test test/absinthe/phase/document/validation/fields_on_correct_type_test.exs:110 - name: Run unit tests with persistent_term backend run: | - MIX_ENV=test mix clean - mix test + mix clean + mix test test/absinthe/phase/document/validation/fields_on_correct_type_test.exs:110 env: SCHEMA_PROVIDER: persistent_term - # - name: Cache/uncache PLTs - # uses: actions/cache@v3 - # with: - # path: | - # priv/plts - # key: "v1-${{ runner.os }}-\ - # erlang-${{ matrix.otp }}-\ - # elixir-${{ matrix.elixir }}-\ - # ${{ hashFiles('mix.lock') }}" + - name: Cache/uncache PLTs + uses: actions/cache@v3 + with: + path: | + priv/plts + key: "v1-${{ runner.os }}-\ + erlang-${{ matrix.otp }}-\ + elixir-${{ matrix.elixir }}-\ + ${{ hashFiles('mix.lock') }}" - name: Run Dialyzer run: mix dialyzer diff --git a/lib/absinthe/phase/document/validation/fields_on_correct_type.ex b/lib/absinthe/phase/document/validation/fields_on_correct_type.ex index 58911b58d6..53f3bf1c3b 100644 --- a/lib/absinthe/phase/document/validation/fields_on_correct_type.ex +++ b/lib/absinthe/phase/document/validation/fields_on_correct_type.ex @@ -156,23 +156,27 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectType do Generate an error for a field """ @spec error_message(String.t(), String.t(), [String.t()], [String.t()]) :: String.t() - def error_message(field_name, type_name, type_suggestions \\ [], field_suggestions \\ []) + def error_message(field_name, type_name, type_suggestions \\ [], field_suggestions \\ []) do + IO.inspect({"error_message", field_name, type_name, type_suggestions, field_suggestions}) - def error_message(field_name, type_name, [], []) do + do_error_message(field_name, type_name, type_suggestions, field_suggestions) + end + + defp do_error_message(field_name, type_name, [], []) do ~s(Cannot query field "#{field_name}" on type "#{type_name}".) end - def error_message(field_name, type_name, [], field_suggestions) do + defp do_error_message(field_name, type_name, [], field_suggestions) do error_message(field_name, type_name) <> Utils.MessageSuggestions.suggest_message(field_suggestions) end - def error_message(field_name, type_name, type_suggestions, []) do + defp do_error_message(field_name, type_name, type_suggestions, []) do error_message(field_name, type_name) <> Utils.MessageSuggestions.suggest_fragment_message(type_suggestions) end - def error_message(field_name, type_name, type_suggestions, _) do + defp do_error_message(field_name, type_name, type_suggestions, _) do error_message(field_name, type_name, type_suggestions) end diff --git a/test/absinthe/phase/document/validation/fields_on_correct_type_test.exs b/test/absinthe/phase/document/validation/fields_on_correct_type_test.exs index 64aaa62880..3c645b7f71 100644 --- a/test/absinthe/phase/document/validation/fields_on_correct_type_test.exs +++ b/test/absinthe/phase/document/validation/fields_on_correct_type_test.exs @@ -8,6 +8,8 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectTypeTest do alias Absinthe.Blueprint defp undefined_field(name, type_name, type_suggestions, field_suggestions, line) do + IO.inspect({"undefined_field", name, type_name, type_suggestions, field_suggestions, line}) + bad_value( Blueprint.Document.Field, @phase.error_message(name, type_name, type_suggestions, field_suggestions), diff --git a/test/support/validation_phase_case.ex b/test/support/validation_phase_case.ex index b865078db7..27ec403e7b 100644 --- a/test/support/validation_phase_case.ex +++ b/test/support/validation_phase_case.ex @@ -27,6 +27,8 @@ defmodule Absinthe.ValidationPhaseCase do import unquote(__MODULE__) def bad_value(node_kind, message, line, check \\ []) do + IO.inspect({"bad_value", node_kind, message, line, check}) + location = unquote(__MODULE__).get_error_location(line) expectation_banner =