Skip to content

[BUG][Kotlin] Kotlin generator ignores apiNameSuffix and uses legacy configOptions.apiSuffix instead #23822

@manujell73

Description

@manujell73

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

apiNameSuffix setting gets ignored when using generatorName = "kotlin"
It does use the configOption apiSuffix.

openapi-generator version

7.22.0

OpenAPI declaration file content or url

Not really any specific file content, just overall Kotlin Api generation

Generation Details

I am using the gradle plugin but this would be the important stuff in the yaml format:

generatorName: kotlin
apiNameSuffix: CustomApi
Steps to reproduce
  1. Configure OpenAPI Generator with generatorName: kotlin.
  2. Set apiNameSuffix: CustomSuffix.
  3. Generate code.
  4. Generated API class names use default Api suffix.
  5. Set additionalProperties.apiSuffix: CustomSuffix and regenerate.
  6. Generated API class names now use the CustomSuffix.
Related issues/PRs

apiSuffix Kotlin implementation: #2690
apiNameSuffix global implementation: #3918

Suggest a fix

I will open a PR, but here is a description:
Remove the Kotlin specific apiSuffix property and use the global apiNameSuffix instead.
Change inside AbstractKotlinCodegen.java line 764.

Since the fix is breaking I will open the PR to the 8.0.x branch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions