ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.24k stars 744 forks source link

Generated client has wrong namespace for ComparisonHelper #5668

Open Redlab1 opened 1 year ago

Redlab1 commented 1 year ago

Is there an existing issue for this?

Describe the bug

When using version 13.0.0-preview.93 of StrawberryShake and generating a client from graphql scheme, the generated client has some methods that depend on "ComparisonHelper". These methods has the wrong namespace in the generated code, they refer to global::StrawberryShake.Helper.ComparisonHelper.SequenceEqual(Items, other.Items) when the correct namespace seems to be "Internal", so this seems correct: global::StrawberryShake.Internal.ComparisonHelper.SequenceEqual(Items, other.Items).

Steps to reproduce

  1. dotnet graphql generate
  2. Open generated client code, check errors.

Relevant log output

Severity    Code    Description Project File    Line    Suppression State
Error   CS0234  The type or namespace name 'Helper' does not exist in the namespace 'StrawberryShake' (are you missing an assembly reference?)  Application ".."\Generated\GraphApiClient.Client.cs 1683    Active

Additional Context?

No response

Product

Strawberry Shake

Version

13.0.0-preview.93

laurentkempe commented 1 year ago

Following the Get started with Strawberry Shake in a Console application I see the same issue and another onr using .NET 7, SDK 7.0.102.

\projects\GraphQL\Console\Demo\StrawberryShake.CodeGeneration.CSharp.Analyzers\StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator\ConferenceClient.StrawberryShake.cs(104,21): Error CS0234 : The type or namespace name 'Helper' does not exist in the namespace 'StrawberryShake' (are you missing an assembly reference?)
\projects\GraphQL\Console\Demo\StrawberryShake.CodeGeneration.CSharp.Analyzers\StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator\ConferenceClient.StrawberryShake.cs(775,740): Error CS1503 : Argument 3: cannot convert from 'StrawberryShake.IOperationStore' to 'System.Func<StrawberryShake.IResultPatcher<System.Text.Json.JsonDocument>>'
\projects\GraphQL\Console\Demo\StrawberryShake.CodeGeneration.CSharp.Analyzers\StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator\ConferenceClient.StrawberryShake.cs(775,887): Error CS1503 : Argument 4: cannot convert from 'StrawberryShake.ExecutionStrategy' to 'StrawberryShake.IOperationStore'
cornonthecobb commented 1 year ago

I am also having this issue and I think its due to the nuget packages for StrawberryShake.CodeGeneration.CSharp.Analyzers still being on version 12.17.0. Inspecting the generated client code it still has references to using 12.17.0.

PascalSenn commented 1 year ago

Hi there I also answerd in #5831 and this solved the issues @cornonthecobb was having:

We added a bunch of new meta packages in 13 that avoid common mistakes that are often done.

Have a look at this: https://chillicream.com/blog/2023/02/08/new-in-hot-chocolate-13#strawberry-shake

laurentkempe commented 1 year ago

Thanks @PascalSenn Now it works. I read the release notes yesterday but when trying the getting started I could not remember that detail. It would be great to update Get started with Strawberry Shake in a Console application