graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

StrawberryShake 12.7.0 Naming an argument "request" results in an error in the generated code.

Open gmiserez opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe the bug

Writing arguments named "request" in Queries results in StrawberryShake generating Code that can not be built.

An easy workaround is of course to simply rename our argument to something else.

Steps to reproduce

Write the following query

query getProjectionBatch(
  $request: BatchProjectionRequest!
) {
  projectionBatch(
    request: $request
  ) {
    foo
  }
}

Relevant log output

error CS0841: Cannot use local variable 'request' before it is declared

Additional Context?

The following Code gets generated:

        public async global::System.Threading.Tasks.Task<global::StrawberryShake.IOperationResult<IGetProjectionBatchResult>> ExecuteAsync(global::XXX.Client.Strawberry.BatchProjectionRequest request, global::System.Threading.CancellationToken cancellationToken = default)
        {
            var request = CreateRequest(request);
            return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
        }

        public global::System.IObservable<global::StrawberryShake.IOperationResult<IGetProjectionBatchResult>> Watch(global::XXX.Client.Strawberry.BatchProjectionRequest request, global::StrawberryShake.ExecutionStrategy? strategy = null)
        {
            var request = CreateRequest(request);
            return _operationExecutor.Watch(request, strategy);
        }

Product

Strawberry Shake

Version

12.7.0

gmiserez avatar Apr 21 '22 14:04 gmiserez