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.25k stars 744 forks source link

Strawberry Shake 13 - Generating client when schema has JSON scalar causes error #5899

Closed tomgrowflow closed 10 months ago

tomgrowflow commented 1 year ago

Is there an existing issue for this?

Product

Strawberry Shake

Describe the bug

Generating client when schema has JSON scalar causes error

After upgrading to version 13.0.4, I'm getting the following error..

Error GQL: An item with the same key has already been added. Key: JSON

31>_GenerateGraphQLCode: dotnet "C:\WINDOWS\ServiceProfiles\NetworkService.nuget\packages\strawberryshake.server\13.0.4\build..\tools\net6\dotnet-graphql.dll" generate "D:\agents\agent02_dev_pr_work\2\s\GrowFlow.ArcClient" -o "D:\agents_work\2\s\ArcClient\obj\Release\netstandard2.0\berry" -n GrowFlow.ArcClient -a md5 -t Generate C# Clients started. Generate ArcClient started. Generate ArcClient completed in 332 ms

I do have a JSON scalar type in my schema defined..

"The JSON scalar type represents JSON values as specified by ECMA-404." scalar JSON

Removing the JSON scalar type from the schema fixes the build issue (edited)

Steps to reproduce

  1. Create new strawberry shake client
  2. Use the schema provided below
  3. Wire up SS client to schema
  4. Build project
  5. Get Error

schema { query: Query mutation: Mutation }

type ApiRequest{ nodeId: ID! id: Int! body: JSON }

"The JSON scalar type represents JSON values as specified by ECMA-404." scalar JSON

Relevant log output

Error GQL: An item with the same key has already been added. Key: JSON
31>_GenerateGraphQLCode:
         dotnet "C:\WINDOWS\ServiceProfiles\NetworkService\.nuget\packages\strawberryshake.server\13.0.4\build\..\tools\net6\dotnet-graphql.dll" generate "D:\agents\agent02_dev_pr\_work\2\s\GrowFlow.ArcClient" -o "D:\agents\_work\2\s\ArcClient\obj\Release\netstandard2.0\berry" -n GrowFlow.ArcClient -a md5 -t
         Generate C# Clients started.
         Generate ArcClient started.
         Generate ArcClient completed in 332 ms

Additional Context?

No response

Version

13.0.4

Doytoend commented 1 year ago

Hi,

"EXEC : error GQL: An item with the same key has already been added. Key: JSON..."

Having the same issue described here. Has anyone found a workaround? I don't control the server portion and there are over 200 JSON scalars in their Schema so removing is not an option for me.

mathewgrabau commented 1 year ago

I am also having the same issue. It seems that I can run the demo alright, but then the issue occurs when I use my schema. I will try reverting to v12 and seeing if that helps.

Intentivekhansen commented 1 year ago

Im getting same error and are not able ommit json scalar. Im using strapi as backend and therefore cannot remove the type. Unfortunatly using v12 wasnt working for me either.

Any news regarding this problem?

joshlrogers commented 1 year ago

FYI, integrating with the Shopify GraphQL API is impossible due to this bug

weirdr commented 1 year ago

First time using this package and I thought this was just me the entire time.

Also having this exact same issue. Was able to Generate the demo with no issues but see this when I go to build:

1>EXEC : error GQL: An item with the same key has already been added. Key: JSON

Hopefully there is a fix soon, kinda stuck :(

mathewgrabau commented 1 year ago

@rlincoln24 - if you roll back to the previous major version (12), it may work (it did in my case, at least). I'm ignorant in the nuances of any specific differences, though. Your experience might be different, but I got it working. The hardest part was ensuring I'd switched all the packages to 12, which caught me initially.

wujun4code commented 1 year ago

+1 case, same issue when graphql schema contains a JSON scalar type.

gerwim commented 1 year ago

Same issue, tried to migrate from Strawberry Shake v12 to v13 which results in this error.

ifunky commented 1 year ago

I'd really like to use this as well but can't seem to get it going like the above :-(

kpiekara commented 1 year ago

Same here, still don't work on 13.2.0/.NET 7.

clazarev commented 1 year ago

Hi, I think I found the root cause of this issue. I'm creating a PR soon

davidegolzi commented 1 year ago

@clazarev when this fix will be available?

I still have this issue on StrawberryShake.Server 13.5.1

sfnmk commented 11 months ago

Just commenting here that I'm also affected by this bug. Using strapi back-end.

glen-84 commented 10 months ago

Closing, as I'm unable to reproduce this error using Strawberry Shake 13.8.1.