Add simple way to disable @defer support
See original GitHub issueIt doesn’t appear like there’s any (simple) way to disable @defer
support. @defer
support when writing a GraphQL server needs special treatment to send the deferred paths to the client, and in the event that this is not put in place in the code that uses GraphQL-Java, it should be possible to (easily) disable @defer
support at the engine level (by ignoring @defer
in queries, or failing to validate them).
For now, I can think of only one way to implement this, which is by writing my own instrumentation to either rewrite the Document
and/or OperationDefinition
to remove @defer
in instrumentExecutionContext
, or to reject @defer
usage altogether in beginValidation
(for that case, it might also be possible to make sure the GraphQLSchema
does not contain the Directives.DeferDirective
; when using SchemaGenerator
, this requires duplicating the built schema to remove the directive).
Such instrumentations (or any other way of disabling @defer
) should IMO be provided out of the box by GraphQL-Java. WDYT?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
@defer
is not longer on by default in master (which will be released in 13.0 at some stage)After finding this example, the following line enabled it again.
schema.transform(builder -> builder.additionalDirective(Directives.DeferDirective));