Open kamal-github opened 1 year ago
I don't think Kotlin supports oenOf yet. Java client generator has better support for oneOf and you can give it a try to see if the oneOf implementation looks to you.
If it does, would you like to contribute a PR to implement oneOf support in the Kotlin client generator?
@wing328 @jimschubert Is there any chance or plan that Kotlin generators(esp. with jvm-ktor librabrt) also supports this features in near future? I checked with go, it seem to be working fine.
Would you or your company like to sponsor the enhancement?
I've run into a similar issue. In my case the input spec is
BadRequestError_errors:
type: object
properties:
parameters:
type: object
additionalProperties:
oneOf:
- type: string
description: The actual value of the parameter.
- type: array
description: The array with the collection of parameter values.
items:
type: string
and the generated kotlin classes are
data class BadRequestErrorErrors (
@field:JsonProperty("parameters")
val parameters: kotlin.collections.Map<kotlin.String, BadRequestErrorErrorsParametersValue>? = null
)
data class BadRequestErrorErrorsParametersValue ()
I've also tried to generate the java classes but they are basically the same, except of course there's no data
modifier. So while the generated Java code compiles I wouldn't claim that it's correct because it completely ignores the values of the parameters
object.
Note: Digging a little bit deeper I realized that this is in fact a regression because it stopped working (both for Koltin and Java) in 7.0.0 while it worked in 6.6.0.
Bug Report Checklist
Description
In case of
oneOf
in open api declaration file. The generated code is containing data class with empty parameter for Kotlin generator.openapi-generator version
7.0.0
OpenAPI declaration file content or url
Generation Details
./gradlew assemble
Steps to reproduce
Related issues/PRs
Suggest a fix