Skip to content

feat: Warn on deprecated enum values used as arguments#5277

Open
jungwoo3490 wants to merge 1 commit into
facebook:mainfrom
jungwoo3490:feat/warn-deprecated-enum-values
Open

feat: Warn on deprecated enum values used as arguments#5277
jungwoo3490 wants to merge 1 commit into
facebook:mainfrom
jungwoo3490:feat/warn-deprecated-enum-values

Conversation

@jungwoo3490
Copy link
Copy Markdown
Contributor

@jungwoo3490 jungwoo3490 commented May 9, 2026

Summary

GraphQL allows @deprecated on enum values, but Relay wasn't warning when a deprecated enum value was used as a field or directive argument. This PR adds that validation alongside the existing deprecated field/argument checks.

enum Status {
  ACTIVE
  LEGACY @deprecated(reason: "Use ACTIVE instead.")
}

# Before: no warning
# After: The enum value `LEGACY` of type `Status` is deprecated. Deprecation reason: "Use ACTIVE instead."
fragment Foo on Query {
  user(status: LEGACY)
}

The warning message wording follows the existing patterns in the codebase. Open to suggestions if there's a better way to phrase it!

Note

Variable values ($status) and deeply nested enum values inside constant objects/arrays are not yet covered. Left a TODO comment in the code.

@meta-cla meta-cla Bot added the CLA Signed label May 9, 2026
@jungwoo3490 jungwoo3490 changed the title feat: Warn when deprecated enum values are used as arguments feat: Warn on deprecated enum values used as arguments May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant