[kotlin-client] Add support for integer enums in serialization step#21248
Merged
4brunu merged 1 commit intoOpenAPITools:masterfrom May 19, 2025
Merged
Conversation
Contributor
|
@CHervaudBetclic did you tested this locally? |
Contributor
Author
|
@4brunu Hello |
Contributor
|
Thanks, looks good to me 👍 |
Contributor
Author
|
@4brunu Do you have any idea about the next release date? |
Contributor
|
You can find the next planned release date on the readme. |
Contributor
4brunu
added a commit
to 4brunu/openapi-generator
that referenced
this pull request
Jun 29, 2025
…n for kotlin-client (OpenAPITools#21248)" This reverts commit 0aaeb45.
5 tasks
Contributor
|
This PR was reverts #21491 |
Member
|
@CHervaudBetclic can you please have a look and file another PR to add integer enum support when you've time? |
This was referenced Aug 14, 2025
Contributor
Author
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Following this issue, when using integer enums with the kotlin-client generator, the generated enum will look like this:
You can see the values of the enum members are not integers, they are strings (
value = "0").Using integer enums, it's should look like this:
How to test
test.ymlfile with the following content:config.jsonfile to generate only relevant content with the following:{ "modelPackage": "com.test", "generatorName": "kotlin", "enumPropertyNaming": "UPPERCASE", "additionalProperties": { "serializableModel": true, "omitGradleWrapper": true, "omitGradlePluginVersions": true }, "globalProperties": { "apis": false, "models": "", "apiDocs": false, "modelDocs": false, "apiTests": false, "modelTests": false } }./mvnw clean install -DskipTests -Dmaven.javadoc.skip=truejava -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i test.yml -g kotlin -o out/ -c config.jsonStringCode.kt) and integer enums (Code.kt)PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)Hello all @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l, could you take a look please? 😁