Skip to content

Conversation

@heyvito
Copy link

@heyvito heyvito commented Nov 6, 2025

This pull request adds support for renaming Go enum values via a new rename_enum option in the configuration. The changes update the code generation logic to use custom names for enum values if specified, and ensure that enum value renaming is handled consistently across global and local options.

Configuration and code generation enhancements:

  • Added a new RenameEnum field to the Options and GlobalOptions structs in internal/codegen/golang/opts/options.go, allowing users to specify custom names for enum values. [1] [2]
  • Updated the JSON schema in internal/config/v_two.json to support the new rename_enum configuration property.
  • Modified the Parse function in internal/codegen/golang/opts/options.go to merge global RenameEnum mappings into local options during parsing.

Enum value naming logic improvements:

  • Changed the EnumValueName function in internal/codegen/golang/enum.go to accept options and use the custom name from RenameEnum if available, as well as to respect initialisms.
  • Updated enum value generation in internal/codegen/golang/result.go to use the new EnumValueName logic, ensuring renamed values are used in generated code.

These changes closes #2129.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang labels Nov 6, 2025
@heyvito heyvito marked this pull request as draft November 6, 2025 01:33
@heyvito heyvito marked this pull request as ready for review November 7, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum renaming

1 participant