ChilliCream / ChilliCream/graphql-platform

Strawberry Shake generates multiple date fields with same name type date and Date are query parameters

Open
#6,971 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Strawberry Shake

Version

13.8.1

Link to minimal reproduction

https://github.com/robc88Farm/net/blob/main/QueryDateQuestion.graphql

Steps to reproduce

We're trying to use Strawberry Shake to generate code for a query with the signature you can see in the link. As you can see in the linked file, this query has both a date and a Date parameter. I add the query to my Hasura project and attempt to build the solution.

What is expected?

I'd expect the generated two date parsers and two date formatters to have different names, or for there to be a way to specify the names of the generated fields.

What is actually happening?

When the code auto-generates, it produces two date formatters and two date parsers with the same name. This results in a broken build. I've found that if I manually change the names of one of the date formatters and one of the date parsers, the project will build.

Here is what SS produces:

private readonly global::StrawberryShake.Serialization.IInputValueFormatter _dateFormatter;
private readonly global::StrawberryShake.Serialization.IInputValueFormatter _dateFormatter;

// in constructor:

_dateFormatter = serializerResolver.GetInputValueFormatter("date");
_dateFormatter = serializerResolver.GetInputValueFormatter("Date");


// and

private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _dateParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.DateTime> _dateParser;


// in constructor:
 _dateParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("date") ?? throw new global::System.ArgumentException("No serializer for type `date` found.");
 _dateParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.DateTime>("Date") ?? throw new global::System.ArgumentException("No serializer for type `Date` found.");
Relevant log output

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked QueryDateQuestion.graphql reproduction and inspect the Strawberry Shake code-generation entry points that create input formatters and leaf parsers. Reproduce the build with both date and Date parameters, then verify that the generated members and constructor assignments have distinct names and the solution builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.