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.27k stars 747 forks source link

Schema contains type already defined in strawberry shake #5361

Open DacoTaco opened 2 years ago

DacoTaco commented 2 years ago

Is there an existing issue for this?

Describe the bug

im currently using strawberry shake to generate a http client to communicate with a graphQL api. in the schema a type 'Uri' is defined with the following :

type Uri
{ 
    path: String!
}

however, compiling my project with this in my schema.graphql i get CSC : error SS0006: The name `Uri` was already registered by another type.. I assume it is confusing it with System.Uri?

i have no control over the api's schema so im stuck with this and fixing it on my client's side.

Steps to reproduce

  1. git clone git@github.com:DacoTaco/TicketSwapPoller.git
  2. Uncomment the following in TicketSwapPoller/schema.graphql:
    #type Uri
    #{
    #   path: String
    #}
  3. dotnet build

Relevant log output

No response

Additional Context?

No response

Product

Strawberry Shake

Version

13.8.1

michaelstaib commented 2 years ago

No, the URI type is a standard scalar and I guess the collision is rather with the GraphQL scalar type URI. The SS0006 error code comes from the GraphQL analyzer. This would be a bug ... will have a look at this.

DacoTaco commented 2 years ago

eh? URI is a standard graphql scalar? i thought it was URL that was a standard scalar?

DacoTaco commented 1 year ago

could the stale tag be removed? or has this bug been fixed?

michaelstaib commented 1 year ago

Its not a standard type .... meant builtin.

michaelstaib commented 1 year ago

Can you provide a minimal repro?

DacoTaco commented 1 year ago

i will see if i can make a minimal example tomorrow, but in the meantime the problem was found in my ticketswap poller : https://github.com/DacoTaco/TicketSwapPoller/tree/main/TicketSwapPoller their schema has an URI object with (at least) a string called 'path'.

DacoTaco commented 1 year ago

@michaelstaib , i have stripped the little code that was in there and have left everything out besides the basic schema + URI & something so it would generate the client. in the real program a query uses the URI scalar

TicketSwapPoller_bare_minimum.zip

glen-84 commented 10 months ago

@DacoTaco

I'm not able to build the solution. I get:

CSC : error SS0006: Method not found: 'Void StrawberryShake.CodeGeneration.CSharp.CSharpGeneratorSettings.set_RequestStrategy(StrawberryShake.Tools.Configuration.RequestStrategy)'. [/home/glen/projects/TicketSwapPoller_bare_minimum/TicketSwapPoller/TicketSwapPoller.csproj] /home/glen/projects/TicketSwapPoller_bare_minimum/TicketSwapPoller/Program.cs(23,10): error CS1061: 'IServiceCollection' does not contain a definition for 'AddTicketSwapClient' and no accessible extension method 'AddTicketSwapClient' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?) [/home/glen/projects/TicketSwapPoller_bare_minimum/TicketSwapPoller/TicketSwapPoller.csproj]

DacoTaco commented 10 months ago

@glen-84 : does the repo still compile?

glen-84 commented 10 months ago

@glen-84 : does the repo still compile?

No.

DacoTaco commented 10 months ago

@glen-84 : does the repo still compile?

No.

i just did a fresh git clone of the repo i linked above, and it build just fine. the bare minimum indeed doesn't build, but it also shows the error of the URI. i can't remember what i did for the bare minimum, as it has been nearly 2 years since i started this issue, but i suggest using the repo if you really want something buildable. to cause the issue you can find the Uri in schema.graphql and uncomment it.

glen-84 commented 10 months ago

I've updated the Steps to reproduce section in the initial comment.