Skip to content

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

@robc88Farm

Description

@robc88Farm

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions