From 0db27b3340dbefad4a02b6b867fb4dc524669b38 Mon Sep 17 00:00:00 2001 From: Aaron Renner Date: Tue, 29 Oct 2024 14:03:21 -0600 Subject: [PATCH] Include deprecated fields args --- priv/graphql/introspection.graphql | 2 +- test/mix/tasks/absinthe.schema.json_test.exs | 23 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/priv/graphql/introspection.graphql b/priv/graphql/introspection.graphql index 62369e5839..c1088e4afd 100644 --- a/priv/graphql/introspection.graphql +++ b/priv/graphql/introspection.graphql @@ -32,7 +32,7 @@ fragment FullType on __Type { fields(includeDeprecated: true) { name description - args { + args(includeDeprecated: true) { ...InputValue } type { diff --git a/test/mix/tasks/absinthe.schema.json_test.exs b/test/mix/tasks/absinthe.schema.json_test.exs index b4ce25dc65..163c1aec5e 100644 --- a/test/mix/tasks/absinthe.schema.json_test.exs +++ b/test/mix/tasks/absinthe.schema.json_test.exs @@ -14,7 +14,7 @@ defmodule Mix.Tasks.Absinthe.Schema.JsonTest do field :update_item, type: :item, args: [ - id: [type: non_null(:string)], + id: [type: non_null(:string), deprecate: true], item: [type: non_null(:input_item)] ] end @@ -143,6 +143,27 @@ defmodule Mix.Tasks.Absinthe.Schema.JsonTest do assert "deprecatedField" in input_thing_field_names assert "deprecatedFieldWithReason" in input_thing_field_names assert "deprecatedNonNullField" in input_thing_field_names + + # Includes deprecated args by default + update_item_arg_names = + get_in( + decoded_schema, + [ + "data", + "__schema", + "types", + Access.filter(&(&1["name"] == "RootMutationType")), + "fields", + Access.filter(&(&1["name"] == "updateItem")), + "args", + Access.all(), + "name" + ] + ) + |> List.flatten() + + assert "id" in update_item_arg_names + assert "item" in update_item_arg_names end @tag :tmp_dir