Add config option to set enum case

Open
#310 0 comments 6 reactions 1 assignee View on GitHub

@fabien0102 is already working on this.

Since Oct 1, 2025.

Assessment

This issue has not been assessed yet.

Description

With #282 the casing of generated Enums was changed from some broken/inconsistent state to using PascalCase as default. While the TypeScript docs also uses PascalCase in the examples, I think it would be good to have a config option, to change it.

The TypeScript generators listed on openapi-generator.tech all have an enumPropertyNaming option which allows:

  • camelCase
  • PascalCase
  • snake_case
  • UPPERCASE
  • original

From my understanding this is the place where the config value should be read and matching formatter should be called:

https://github.com/fabien0102/openapi-codegen/blob/4c0f66935a4cf299ce9818be22f9ff6acbc39158/plugins/typescript/src/core/schemaToEnumDeclaration.ts#L79

Also the filenameCase option already have more or less the values this new config option would need:

https://github.com/fabien0102/openapi-codegen/blob/4c0f66935a4cf299ce9818be22f9ff6acbc39158/plugins/typescript/src/generators/types.ts#L27

Overall this shouldn't be a complicated but much appreciated change.

Please let me know if you need any more information on this.

Dominant language
TypeScript
Stars
634
Forks
83
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fabien0102/openapi-codegen

All issues in fabien0102/openapi-codegen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.