Skip to content

StrawberryShake: Mutation containing input with a lowercase-named enum type fails generate code #3704

@treet

Description

@treet

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions