Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix.Tasks.Absinthe.Schema.Json nolonger includes deprecated input fields #1327

Open
jweinkam opened this issue Jul 16, 2024 · 6 comments · May be fixed by #1333
Open

Mix.Tasks.Absinthe.Schema.Json nolonger includes deprecated input fields #1327

jweinkam opened this issue Jul 16, 2024 · 6 comments · May be fixed by #1333

Comments

@jweinkam
Copy link

If submitting a bug, please provide the following:

Environment

  • Elixir version (elixir -v):
    Erlang/OTP 25 [erts-13.2.2.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]
    Elixir 1.14.1 (compiled with Erlang/OTP 25)

  • Absinthe version (mix deps | grep absinthe):
    absinthe 1.7.7 (Hex package) (mix)
    locked at 1.7.7 (absinthe) 21455198

  • Client Framework and version (Relay, Apollo, etc):

Expected behavior

In prior versions, when running

  mix absinthe.schema.json --schema MyApp.Schema --json-codec AbsintheSortingCodec --pretty ./schema.json > /dev/null

the generated schema.json file would contain input fields that were marked as deprecated.

Actual behavior

In this version, running the same task omits the deprecated input fields.
No errors are display.

Relevant Schema/Middleware Code

Hacking the absinthe/priv/graphql/introspection.graphql file at line 44 to be inputFields(includeDeprecated: true) { instead of just inputFields { adds back the deprecated input fields.

@matt-savvy
Copy link

We found that default values for :include_deprecated do not seem to be making it to the :resolve functions. Setting the default value true, if I drop in an IO.inspect, the output is still showing false.

For example:

resolve: fn %{include_deprecated: show_deprecated}, %{source: source} ->

@matt-savvy
Copy link

Our solution was to copy the introspection.graphql file to our own repo and explicitly add includeDeprecated: true like mentioned above for args, fields, and inputFields. This got our schema dumps back to the behavior as it was in 1.7.6

@rossvz
Copy link

rossvz commented Jul 30, 2024

We just ran into this after updating from 1.7.6 to 1.7.8 - this feels like a major breaking change since it now hard-removes deprecated fields from the schema. This sort of bypasses the reason to use deprecation in the first place - since the effect is equivalent to just deleting the field entirely. @benwilson512 this change was also not documented anywhere in the CHANGELOG for 1.7.7 which feels risky?

@benwilson512
Copy link
Contributor

Hey @rossvz as implied by the earlier comments, this appears to be a bug, not an intended change. I do not have time to look into this this week but am happy to review any PRs that take a swing at resolving the issue.

@rossvz
Copy link

rossvz commented Jul 30, 2024

@jgautsch I'm curious if you have ideas here, I think you were the author for #1291. Is there anything we need to add on the absinthe side to make this work?

We're using graphql-codegen to generate schema files for our Apollo client, but nothing on the client config side seems to get these fields to appear.

@jgautsch
Copy link
Contributor

@rossvz aside from that PR I'm distant from it enough to probably not be of much help. It looks like setting the default value for includeDeprecated arg to true would fix your issue but maybe wouldn't be in line with the spec. Otherwise the only thing I'd think to do would be to modify your queries, but I'm sure you've thought of that so prob not helpful. I too use graphql-codegen but don't use any deprecated fields. Godspeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants