OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.8k stars 6.58k forks source link

[REQ] [Kotlin] Specifying visibility modifiers #16506

Closed skydoves closed 1 week ago

skydoves commented 1 year ago

Hello Team,

I'm curious if there's a way to specify visibility modifiers for the generated code, particularly for classes, methods, and properties.

We've been making use of the Explicit API mode feature in Kotlin to enforce clear visibility modifiers, and it would be fantastic if we could ensure compatibility with this feature.

hamorillo commented 8 months ago

Another one here with the same case. It would be a great feature!

arcadii-meister commented 2 months ago

Apparently, this feature has been available for some time, thanks to this PR. However, it supports only setting the internal visibility modifier by using this configuration:

openApiGenerate {
    generatorName = "kotlin"
    ...
    additionalProperties = mapOf("nonPublicApi" to "true")
}

On the other hand, it should solve the explicit API mode compatibility.