ChilliCream / ChilliCream/graphql-platform

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

Open
#5,710 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake repro-validated
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is there an existing issue for this?
  • I have searched the existing issues
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
        }
    }
}
  1. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked hc-5710 reproduction project and inspect the generated GraphQLClient.StrawberryShake.cs output for the schema's State enum and EventFilterInputInfo references. Reproduce the .NET compilation errors, then trace the Strawberry Shake C# client generator entry point responsible for these declarations. Done means the supplied schema generates and compiles without CS0101 or CS0538.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.