Skip to content

fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings instead of apiSuffix (generator's option)#23926

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
manujell73:kotlin-apinameprefix-apinamesuffix-master
Jun 3, 2026
Merged

fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings instead of apiSuffix (generator's option)#23926
wing328 merged 1 commit into
OpenAPITools:masterfrom
manujell73:kotlin-apinameprefix-apinamesuffix-master

Conversation

@manujell73
Copy link
Copy Markdown
Contributor

@manujell73 manujell73 commented Jun 2, 2026

fixes (#23822)

As discussed in #23834 opened PR for master aswell as the change has a fallback.

Removes Kotlin specific apiSuffix additionalSetting.
Adds support for global apiNamePrefix and apiNameSuffix settings to the kotlin generator.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Kotlin comittee members:
@karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) @dennisameling (2026/02)


Summary by cubic

Kotlin generators now use the global apiNamePrefix and apiNameSuffix for API class names, replacing the Kotlin-only apiSuffix. Default behavior is unchanged: classes end with Api, and empty names produce DefaultApi.

  • Bug Fixes

    • AbstractKotlinCodegen.toApiName now builds names as prefix + camelized name + suffix; empty names return DefaultApi.
    • Removed apiSuffix across the codebase (including CodegenConstants, generator options, docs, and tests). Added tests for prefix, suffix, and prefix+suffix.
  • Migration

    • Replace -DapiSuffix=Foo with -DapiNameSuffix=Foo (and -DapiNamePrefix=Bar if needed). No change if you use the default Api suffix.

Written for commit 25a101a. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

Re-trigger cubic

@manujell73 manujell73 force-pushed the kotlin-apinameprefix-apinamesuffix-master branch from a162fb8 to 25a101a Compare June 2, 2026 19:23
@wing328 wing328 added this to the 7.23.0 milestone Jun 3, 2026
@wing328 wing328 merged commit 4e31e4d into OpenAPITools:master Jun 3, 2026
14 checks passed
@wing328 wing328 changed the title fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings (#23822) fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings instead of apiSuffix Jun 3, 2026
@wing328 wing328 changed the title fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings instead of apiSuffix fix(Kotlin): use the global apiNamePrefix and apiNameSuffix settings instead of apiSuffix (generator's option) Jun 3, 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.

2 participants