ChilliCream / ChilliCream/graphql-platform
StrawberryShake 12.7.0 Naming an argument "request" results in an error in the generated code.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Is there an existing issue for this?
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the query with the argument named "request" and inspect the generated ExecuteAsync and Watch methods shown in the issue. Build the generated StrawberryShake client and confirm the fix prevents the local-variable naming conflict while preserving request creation and execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100