Skip to content

Commit

Permalink
[GRAPH-1110] Merge in v1.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjos committed Jul 15, 2024
2 parents c9a0dea + cb2b766 commit a9f14b2
Show file tree
Hide file tree
Showing 62 changed files with 536 additions and 181 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/check_dependents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check Dependents

on:
push:
pull_request:
branches:
- master

jobs:
test_dependents:
name: Ensure ${{ matrix.dependent }} tests pass
runs-on: ubuntu-24.04

strategy:
matrix:
dependent:
- 'absinthe_plug'
- 'absinthe_phoenix'
- 'absinthe_relay'

steps:
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.17'
otp-version: '27'

- name: Checkout absinthe
uses: actions/checkout@v4

- name: Checkout ${{ matrix.dependent }}
uses: actions/checkout@v4
with:
repository: 'absinthe-graphql/${{ matrix.dependent }}'
path: '${{ matrix.dependent }}'

- name: Install absinthe package dependencies
run: mix deps.get

- name: Update absinthe dependency
run: 'sed -i -e "s|{:absinthe,.*|{:absinthe, path: \"$GITHUB_WORKSPACE\", override: true},|" mix.exs'
working-directory: ./${{ matrix.dependent }}

- name: Install ${{ matrix.dependent }} package dependencies
run: mix deps.get
working-directory: ./${{ matrix.dependent }}

- name: Run unit tests
run: |
mix clean
mix test
working-directory: ./${{ matrix.dependent }}
36 changes: 16 additions & 20 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,25 @@ on:
jobs:
test:
name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
elixir:
- "1.13"
- "1.14"
- "1.15"
- '1.15'
- '1.16'
- '1.17'
otp:
- "24"
- "25"
- "26"
include:
- elixir: "1.15"
otp: "26"
format: true
- '25'
- '26'
- '27'
exclude:
- otp: 26
elixir: 1.13
- otp: 26
elixir: 1.14
- otp: 25
elixir: 1.17
- otp: 27
elixir: 1.15
- otp: 27
elixir: 1.16

steps:
- name: Checkout
Expand Down Expand Up @@ -57,7 +55,6 @@ jobs:

- name: Check Formatting
run: mix format --check-formatted
if: ${{ matrix.format }}

- name: Run unit tests
run: |
Expand All @@ -77,10 +74,9 @@ jobs:
path: |
priv/plts
key: "v1-${{ runner.os }}-\
erlang-${{ matrix.otp }}-\
elixir-${{ matrix.elixir }}-\
${{ hashFiles('mix.lock') }}"
erlang-${{ matrix.otp }}-\
elixir-${{ matrix.elixir }}-\
${{ hashFiles('mix.lock') }}"

- name: Run Dialyzer
run: mix dialyzer

13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Changelog

## Unreleased
## 1.7.7
- POTENTIALLY BREAKING Bug Fix: [Validate variable usage in nested input arguments](https://github.com/absinthe-graphql/absinthe/pull/1290).This could break incoming documents previously considered valid. Skip the Absinthe.Phase.Document.Arguments.VariableTypesMatch phase to avoid this check. See Absinthe.Pipeline on adjusting the document pipeline.
- #1321 resolves telemetry issues
- Various minor dependency versioning tweaks
- Handle Elixir 1.17 warnings

## 1.7.6

- Bugfix: [Handle non_null(list_of(:thing)) with null list elements properly](https://github.com/absinthe-graphql/absinthe/pull/1259)
- Bugfix: [More non null result handling improvements](https://github.com/absinthe-graphql/absinthe/pull/1275)

## 1.7.4
## 1.7.5

- Feature: Support Dataloader 2.0

Expand Down Expand Up @@ -33,6 +39,7 @@
- Bug Fix: [Validate field identifier uniqueness](https://github.com/absinthe-graphql/absinthe/pull/1200)
- Bug Fix: [Validate type references for invalid wrapped types](https://github.com/absinthe-graphql/absinthe/pull/1195)
- Bug Fix: Adds **optional fix** for non compliant built-in scalar Int type. `use Absinthe.Schema, use_spec_compliant_int_scalar: true` in your schema to use the fixed Int type. It is also advisable to upgrade for custom types if you are leveraging the use of integers outside the GraphQl standard. [#1131](https://github.com/absinthe-graphql/absinthe/pull/1131).
- Feature: [Support custom opts in schema pipeline modifiers](https://github.com/absinthe-graphql/absinthe/pull/1214)
- Feature: [Support error tuples when scalar parsing fails](https://github.com/absinthe-graphql/absinthe/pull/1187)
- Feature: [Convert SDL Language.\* structs to SDL notation](https://github.com/absinthe-graphql/absinthe/pull/1160)
- Feature: [Support passing the resolution struct to dataloader helper callbacks](https://github.com/absinthe-graphql/absinthe/pull/1211)
Expand Down Expand Up @@ -171,7 +178,7 @@ Alpha 0 note: 1.5.0 alpha is safe to use on existing schemas. However, there are
- Complete rewrite of schema internals. This fixes a number of long standing bugs, and provides a variety of new features
- Feature: SDL support
- Feature: Schema decorators
- Feature: Customizable subscription de-duplification. See: https://github.com/absinthe-graphql/absinthe/blob/master/guides/subscriptions.md#de-duplicating-updates
- Feature: Customizable subscription de-duplification. See: https://github.com/absinthe-graphql/absinthe/blob/main/guides/subscriptions.md#de-duplicating-updates
- Feature: Built-in `telemetry` instrumentation (https://github.com/beam-telemetry/telemetry)
- Breaking Change: `default_value: DateTime.utc_now()` will have its time set at compile time. IE: DON'T DO THIS. It only worked by accident before anyway, and now it no longer works, which is correct.
- Breaking change: added `node_name/0` callback to `Absinthe.Subscription.PubSub` behaviour. To retain old behaviour, implement this callback to return `Kernel.node/0`.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Make your change. Add tests for your change. Make the tests pass:

mix test

Push to your fork (preferably to a non-`master` branch) and
Push to your fork (preferably to a non-`main` branch) and
[submit a pull request][pr].

[pr]: https://github.com/absinthe-graphql/absinthe/compare/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/absinthe/)
[![Download](https://img.shields.io/hexpm/dt/absinthe.svg)](https://hex.pm/packages/absinthe)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Last Updated](https://img.shields.io/github/last-commit/absinthe-graphql/absinthe.svg)](https://github.com/absinthe-graphql/absinthe/commits/master)
[![Last Updated](https://img.shields.io/github/last-commit/absinthe-graphql/absinthe.svg)](https://github.com/absinthe-graphql/absinthe/commits/main)

[GraphQL](https://graphql.org) implementation for Elixir.

Expand Down
2 changes: 1 addition & 1 deletion guides/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end
```


You may want to refer to the [Absinthe API documentation](https://hexdocs.pm/absinthe/) for more detailed information as you look this over.
You may want to refer to the [Absinthe API documentation](introduction/overview.md) for more detailed information as you look this over.


Some macros and functions used here that are worth mentioning, pulled in automatically from
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/blueprint/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Absinthe.Blueprint.Schema do

def functions(module) do
if function_exported?(module, :functions, 0) do
module.functions
module.functions()
else
[]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/blueprint/schema/object_type_definition.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ defmodule Absinthe.Blueprint.Schema.ObjectTypeDefinition do
deprecation: field_def.deprecation,
description: field_def.description,
complexity: field_def.complexity,
config: field_def.complexity,
config: field_def.config,
triggers: field_def.triggers,
name: field_def.name,
type: Blueprint.TypeReference.to_type(field_def.type, schema),
Expand Down
31 changes: 22 additions & 9 deletions lib/absinthe/middleware/batch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ defmodule Absinthe.Middleware.Batch do
@behaviour Absinthe.Middleware
@behaviour Absinthe.Plugin

require Logger

@typedoc """
The function to be called with the aggregate batch information.
Expand Down Expand Up @@ -143,18 +145,29 @@ defmodule Absinthe.Middleware.Batch do

metadata = emit_start_event(system_time, batch_fun, batch_opts, batch_data)

{batch_opts, task, start_time_mono, metadata}
{batch_opts, task, start_time_mono, metadata, batch_fun}
end)
|> Map.new(fn {batch_opts, task, start_time_mono, metadata} ->
timeout = Keyword.get(batch_opts, :timeout, 5_000)
result = Task.await(task, timeout)
|> Map.new(&yield_batching_result/1)
end

end_time_mono = System.monotonic_time()
duration = end_time_mono - start_time_mono
emit_stop_event(duration, end_time_mono, metadata, result)
defp yield_batching_result({batch_opts, task, start_time_mono, metadata, batch_fun}) do
timeout = Keyword.get(batch_opts, :timeout, 5_000)

result
end)
case Task.yield(task, timeout) || Task.shutdown(task) do
{:ok, result} ->
end_time_mono = System.monotonic_time()
duration = end_time_mono - start_time_mono
emit_stop_event(duration, end_time_mono, metadata, result)

result

_ ->
Logger.error(
"Failed to get batching result in #{timeout}ms for\nfn: #{inspect(batch_fun)}"
)

Process.exit(self(), :timeout)
end
end

@batch_start [:absinthe, :middleware, :batch, :start]
Expand Down
24 changes: 20 additions & 4 deletions lib/absinthe/phase/document/arguments/variable_types_match.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ defmodule Absinthe.Phase.Document.Arguments.VariableTypesMatch do
{:halt, node}
end

defp check_variable_type(
%Absinthe.Blueprint.Input.Field{
input_value: %Blueprint.Input.Value{
raw: %{content: %Blueprint.Input.Variable{} = variable}
}
} = node,
operation_name,
variable_defs
) do
compare_variable_with_definition(variable, node, operation_name, variable_defs)
end

defp check_variable_type(
%Absinthe.Blueprint.Input.Argument{
input_value: %Blueprint.Input.Value{
Expand All @@ -68,6 +80,14 @@ defmodule Absinthe.Phase.Document.Arguments.VariableTypesMatch do
operation_name,
variable_defs
) do
compare_variable_with_definition(variable, node, operation_name, variable_defs)
end

defp check_variable_type(node, _, _) do
node
end

defp compare_variable_with_definition(variable, node, operation_name, variable_defs) do
location_type = node.input_value.schema_node
location_definition = node.schema_node

Expand Down Expand Up @@ -95,10 +115,6 @@ defmodule Absinthe.Phase.Document.Arguments.VariableTypesMatch do
end
end

defp check_variable_type(node, _, _) do
node
end

def types_compatible?(type, type, _, _) do
true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectType do
[identifier]

%Type.Interface{identifier: identifier} ->
schema.__absinthe_interface_implementors__
schema.__absinthe_interface_implementors__()
|> Map.fetch!(identifier)

%Type.Union{types: types} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/directive_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Absinthe.Phase.Schema.DirectiveImports do
defp do_imports([{module, opts} | rest], acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections = MapSet.new(Keyword.get(opts, :except, []))

Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/spec_compliant_int.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Absinthe.Phase.Schema.SpecCompliantInt do
defp handle_node(%Blueprint.Schema.ScalarTypeDefinition{identifier: :integer}) do
case ensure_compiled(Absinthe.Type.BuiltIns.SpecCompliantInt) do
{:module, module} ->
[types] = module.__absinthe_blueprint__.schema_definitions
[types] = module.__absinthe_blueprint__().schema_definitions

Enum.find(
types.type_definitions,
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/type_extension_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Absinthe.Phase.Schema.TypeExtensionImports do
defp do_imports([{module, opts} | rest], type_extensions_acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections = Keyword.get(opts, :except, []) |> MapSet.new()

Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/type_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Absinthe.Phase.Schema.TypeImports do
defp do_imports([{module, opts} | rest], types_acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections =
MapSet.new([:query, :mutation, :subscription] ++ Keyword.get(opts, :except, []))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Absinthe.Phase.Schema.Validation.InterfacesMustResolveTypes do
defp validate_interface(%Blueprint.Schema.InterfaceTypeDefinition{} = iface, implementors) do
resolve_type = Absinthe.Type.function(iface, :resolve_type)

if(resolve_type || all_objects_is_type_of?(iface, implementors)) do
if resolve_type || all_objects_is_type_of?(iface, implementors) do
iface
else
iface |> put_error(error(iface))
Expand Down
Loading

0 comments on commit a9f14b2

Please sign in to comment.