private static void ResolveScopedVariableArguments( IResolverContext context, NameString schemaName, SelectionPathComponent component, IOutputField field, ICollection <Delegation.VariableValue> variables, ExtractFieldQuerySyntaxRewriter rewriter) { foreach (ArgumentNode argument in component.Arguments) { if (!field.Arguments.TryGetField(argument.Name.Value, out IInputField arg)) { throw new QueryException( ErrorBuilder.New() .SetMessage( StitchingResources.DelegationMiddleware_ArgumentNotFound, argument.Name.Value) .SetExtension("argument", argument.Name.Value) .SetCode(ErrorCodes.ArgumentNotFound) .Build()); } if (argument.Value is ScopedVariableNode sv) { Delegation.VariableValue variable = _resolvers.Resolve(context, sv, arg.Type); IValueNode value = rewriter.RewriteValueNode( schemaName, arg.Type, variable.Value); variables.Add(variable.WithValue(value)); } } }