Skip to content

Render enum literals in variable defaults as enum constructors - #574

Open
antonshevchenko wants to merge 1 commit into
graphql-rust:mainfrom
antonshevchenko:enum-literals-in-defaults
Open

Render enum literals in variable defaults as enum constructors#574
antonshevchenko wants to merge 1 commit into
graphql-rust:mainfrom
antonshevchenko:enum-literals-in-defaults

Conversation

@antonshevchenko

Copy link
Copy Markdown

An enum literal default is emitted as a string literal, so the generated default function doesn't typecheck.

query Example($kind: Kind! = ACTIVE) {
  things(kind: $kind) { id }
}
error[E0308]: mismatched types
expected `Kind`, found `&str`

Also affects enum literals nested in list and input-object defaults.

An enum literal default was emitted as a string literal, so the generated
default function did not typecheck. Render it as `EnumName::VariantName`,
spelled the way `codegen::enums` spells it when defining the enum.

Co-authored-by: Cursor <cursoragent@cursor.com>
@antonshevchenko
antonshevchenko marked this pull request as ready for review August 5, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant