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.13k stars 728 forks source link

Error generating client according to schema with "State" type. error CS0101 #5710

Open vvdruzev opened 1 year ago

vvdruzev commented 1 year ago

Is there an existing issue for this?

Product

Strawberry Shake

Describe the bug

If the schema is of type State, an error occurs during compilation: error CS0101: The namespace "MyNameSpace" already contains a definition for "State".

The type cannot be renamed. I am a consumer of this scheme.

Steps to reproduce

https://github.com/glen-84/hc-5710 (.NET 8, SS 13.8.1)

  1. Schema with the "State" type
    schema {
        query: Query
    }
    type Event {
        idd: ID!
        type: String!
        productId: ID
        Result: State!
    }
    enum State {
        SUCCESS
        FAIL
    }
    type Events {
        nodes: [Event!]
        totalCount: Int!
    }
    input EventFilterInput {
        productId: ID
    }
    type Query {
        Events(filter: EventFilterInput!): Events
    }

    Query:

    query GetEvents($filter: EventFilterInput!) {
    Events(filter: $filter) {
        totalCount
        nodes {
            type
            productId
            Result
        }
    }
    }
  2. Compilation of the project.

Relevant log output

StrawberryShake.CodeGeneration.CSharp.Analyzers/StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator/GraphQLClient.StrawberryShake.cs(369,17): error CS0101: Пространство имен "MyNameSpace" уже содержит определение для "State".
         StrawberryShake.CodeGeneration.CSharp.Analyzers/StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator/GraphQLClient.StrawberryShake.cs(365,32): error CS0538: "State.IEventFilterInputInfo" в явном объявлении интерфейса не является интерфейсом.

Additional Context?

No response

Version

12.16.0

vvdruzev commented 1 year ago

Up

dibble-james commented 11 months ago

Just come across this too, a GraphQL endpoint we use also defines a State enum and as soon as you query a field that uses that enum, SS can no longer generate a client.

vvdruzev commented 11 months ago

But I need my type State.