apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Deterministic Enum Case Ordering in Generated Files

Open KaannnOzdemiir opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe. Yes. When Apollo generates enum files, the order of enum cases changes with each generation. This inconsistency leads to unnecessary diffs in version control systems like Git, making it harder to track meaningful changes.

Describe the solution you'd like We would like Apollo to generate enum cases in a stable and deterministic order—preferably sorted alphabetically or based on their appearance in the schema—so that repeated generations produce the same output unless the underlying schema has changed.

Describe alternatives you've considered We’ve considered writing custom scripts to sort the enum cases after generation, but this adds complexity and maintenance overhead to our build pipeline.

Additional context This issue causes noise in pull requests and complicates code reviews(especially in automated PR creation). Having a built-in, deterministic case ordering in Apollo-generated enums would significantly improve developer experience and CI/CD workflows.

KaannnOzdemiir avatar Apr 11 '25 12:04 KaannnOzdemiir