Skip to content

Commit

Permalink
Trying to find error in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjos committed Jun 14, 2024
1 parent 9a55465 commit b5e6a4e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
49 changes: 23 additions & 26 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
14 changes: 9 additions & 5 deletions lib/absinthe/phase/document/validation/fields_on_correct_type.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions test/support/validation_phase_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit b5e6a4e

Please sign in to comment.