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

Handle deprecation of inputs #267

Closed
fotoetienne opened this issue Jul 22, 2023 · 4 comments
Closed

Handle deprecation of inputs #267

fotoetienne opened this issue Jul 22, 2023 · 4 comments

Comments

@fotoetienne
Copy link

fotoetienne commented Jul 22, 2023

Deprecation of input values has now been merged into the GraphQL spec. This includes a modification to the introspection query.

Without includeDeprecated = true on inputFields in the introspection query, an error occurs on any input objects that have all fields deprecated:
Error: Invalid schema from introspection: Input Object type <typename> must define one or more fields.

GraphiQL now has a flag that determines whether the introspection query should include includeDeprecated = true on inputFields, since only compatible graphs will know about this argument. Sandbox/explorer could do something similar or somehow autodetect whether the graph supports deprecation of input fields.

You just need to set the inputValueDeprecation arg in the graphql-js getIntrospectionQuery function.

@fotoetienne
Copy link
Author

Digging in a bit, I see inputValueDeprecation included in introspectionOptions in src/app/graph/explorerPage/hooks/useExplorerState/useSchema/useSchemaFromEndpointIntrospection/useSchemaFromEndpointIntrospection.ts so maybe this just needs to be exposed or documented.

We are using the embedded sandbox in apollo-router and currently seeing the error described above.

@fotoetienne
Copy link
Author

After more inspection, it seems that the introspection query does include deprecated on inputs. Nevertheless, there is an error in the console for an input type that has all fields deprecated
Screen Shot 2023-07-21 at 6 02 22 PM

@mayakoneval
Copy link
Contributor

Hey! Apologies for the late reply here.

This should be checking the introspection response to see if your __Directive type has includeDeprecated as an arg, and passing includeDeprecated to the introspection options when generating the query already.

I tested on a schema with a deprecated input field and am seeing it work alright: https://codesandbox.io/p/sandbox/as4-integration-testing-e90bft?file=%2Fsrc%2Fserver.ts%3A11%2C1-13%2C4

Would you be able to validate for me the version of graphql js you are using? 🙏🏻

@mayakoneval
Copy link
Contributor

closing as we have not heard back

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

No branches or pull requests

2 participants