Skip to content

Strawberry Shake: Code generation fails when GraphQL field names conflict with System.Object method names #8934

@karlssberg

Description

@karlssberg

Product

Strawberry Shake

Version

15.1.11

Link to minimal reproduction

https://github.com/karlssberg/strawberry-shake-bug

Steps to reproduce

  1. Create a GraphQL schema with a type containing a field named equals:
type StringMatch {
  equals: String
}
  1. Generate Strawberry Shake client code
  2. Attempt to build the project

What is expected?

The code generator should detect C# reserved method names and either:

  • Automatically suffix the property name (e.g., EqualsEqualsValue or Equals_)
  • Provide a configuration option to customize property naming

What is actually happening?

Generated code creates a property named Equals which conflicts with System.Object.Equals(object), causing compilation errors:

error CS0102: The type 'StringMatch' already contains a definition for 'Equals'

Additional context

Also affects input declarations that contain fields matching System.Object method names.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions