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

refactor: Validate or add @defer directive in schema #403

Conversation

calvincestari
Copy link
Member

@calvincestari calvincestari commented Jun 26, 2024

Closes apollographql/apollo-ios#3287.

The change here is to:

  1. Validate any @defer directive that is in the schema document. The validation is to ensure that any schema definition matches the experimental definition of the directive in graphql-js. We do this because some server implementations allow @defer to be used in other locations, such as FIELD, and Apollo iOS codegen does not support those definitions. If an unsupported @defer directive definition is found a warning will be output and the definition will be automatically replaced with a version that we do support. This could result in operation validation failing if the directive was being used in a way that does not match the replaced definition.
  2. Automatically add a @defer directive if it is not found in the schema. This mimics the eventual state of the defer proposal where the directive is available to be used without explicit definition.

@calvincestari
Copy link
Member Author

@AnthonyMDev this is ready for another review, should be all done.

@calvincestari calvincestari merged commit 6d2f4e6 into feature/defer-execution-networking Jul 9, 2024
17 checks passed
@calvincestari calvincestari deleted the defer/validate-add-defer-directive branch July 9, 2024 17:54
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 this pull request may close these issues.

Validate @defer directive in schema matches GraphQL spec definition
2 participants