Closed tninesling closed 1 month ago
The lookup failure was caused by user error. This change is no longer required
For anyone finding this later: the type name given to Schema::type_field
must be the type of the parent selection set (the type whose definition contains the field definition we want), not the type of the field.
Description
When processing operations in the demand control plugin, we traverse the
ExecutableDocument
and score each field based on its type and directives. Specifically, we check for directives applied to the schema. Since the router's request pipeline parses operations using the API schema instead of the supergraph schema, these directives onFieldDefinition
s are stripped.It has been suggested that we look up the supergraph schema's definitions using
Schema::type_field
, but this returns aNoSuchField
error for scalars, unions, enums, and input objects. Instead, these variants should have the same definition lookup functionality as objects and interfaces.Proposal
For variants of
ExtendedType
which do not already have it, add a field definition mapping equivalent to that on objects and interfaces:pub fields: IndexMap<Name, Component<FieldDefinition>>
. Then use the new lookups insideSchema::type_field
.