ChilliCream / ChilliCream/graphql-platform
StrawberryShake: Mutation containing input with a lowercase-named enum type fails generate code
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Code generation fails when I try to generate code for a mutation containing a lowercase-named enum type. If I rename jobstatus to JobStatus in the schema below, dotnet build succeeds and code is generated.
This feels like very strange behavior, is this a bug or am I going crazy?
This makes StrawberryShake unusable with e.g. Hasura (https://hasura.io/) which always use lowercase for all GraphQL types.
Error message
$ dotnet build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
CSC : error SS0006: The given key 'StrawberryShake.RuntimeType' was not present in the dictionary.
Build FAILED.
CSC : error SS0006: The given key 'StrawberryShake.RuntimeType' was not present in the dictionary.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:03.85
To Reproduce
In a new project, attempt to generate code with the following schema and mutation. This is not my original schema, but the minimum schema I could come up with that produces the error.
InsertJobs.graphql
mutation InsertJobs($object: JobInput!) {
insertJobs(object: $object)
}
schema.graphql
schema {
query: QueryRoot
mutation: MutationRoot
}
enum jobstatus {
Started
Processing
Finished
}
type Job {
status: jobstatus!
}
input JobInput {
status: jobstatus!
}
type InsertJobsResponse {
returning: Job!
}
type QueryRoot {
jobs(): [Job!]!
}
type MutationRoot {
insertJobs(object: JobInput!): Boolean!
}
Desktop (please complete the following information):
- OS: Win10 (WSL)
- Version: StrawberryShake.CodeGeneration.CSharp.Analyzers 12.0.0-preview.3
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 with the minimal reproduction in InsertJobs.graphql and schema.graphql, then run dotnet build using StrawberryShake.CodeGeneration.CSharp.Analyzers. Trace the code-generation path producing SS0006 for the lowercase jobstatus enum. Done means the mutation generates successfully without renaming the enum to JobStatus.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100