refactor: Validate or add @defer
directive in schema
#403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes apollographql/apollo-ios#3287.
The change here is to:
@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 asFIELD
, 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.@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.