ChilliCream / ChilliCream/graphql-platform
Issue on client query code generator
Nobody has claimed this yet.
- 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
Describe the bug
under some circustance the code generated by StrawberryShake generate classes that do not compile due to a
Compiler Error CS0542 - 'user-defined type' : member names cannot be the same as their enclosing type
this happens when in a query definition is present a type with a property named as "[TypeName]Data"
the code generator Generate a class for each type named "[TypeName]Data" so any property in that type that has that name produce the compiler erroe CS0542
Steps to reproduce
- write a simple query selecting a type that has a property named the same as the typeitself + "Data"
Example Schema Type:
type Test {
TestData: String
}
Relevant log output
Compiler Error CS0542 - 'user-defined type' : member names cannot be the same as their enclosing type
Additional Context?
I'm not familiar on what library is doing the code generator, but i found this bugs including in my .net core 7 project the preview package StrawberryShake.Server/13.0.0-preview.91 with his dependency
Product
Strawberry Shake
Version
13.0.0-preview.91
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the StrawberryShake client query code generator and reproduce the issue with the provided Test schema and query. Trace how generated [TypeName]Data classes handle a property named [TypeName]Data; done means the generated C# compiles without CS0542 and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, graphql
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100