Open mgallagher-jamf opened 2 years ago
We have the same issue.
With some debugging, I see that isMap
is true on the template even if the schema is not a map but a plain object.
When we remove the type: object
the generated code is valid again.
I will try to submit a pull request.
Basic PR with steps to reproduce https://github.com/OpenAPITools/openapi-generator/pull/12594
The pull request is redy for review :slightly_smiling_face:
Was the PR merged? I met the same problem with openapi-generator-maven-plugin 6.4.0.
Was the PR merged? I met the same problem with openapi-generator-maven-plugin 6.4.0.
The pr was only for the kotlin generator
@alexbudarov can you please give it a try with the latest master to see if you still experience the same issue?
According to https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/kotlin.md#schema-support-feature "allOff" feature is not yet supported. If PR #12594 fixes that, please update the documentation 👍 However, I get wrong generated code using "allOff", but it might be caused by some other issue.
This seems to be fixed in 7.0.1
[BUG] Kotlin generator produces invalid code when allOf is used
Description
The Kotlin generator produces invalid code when using
allOf
in the SpecActual
Expected
The generated code for the class
Bird
is attempting to call the constructor on theAnimal
interface it is implementing. Kotlin interfaces do not have constructors.openapi-generator version
The bug exists using
5.3.0
, the issue is not present in5.2.1
OpenAPI declaration file content or url
Generation Details
Use openapi-generator-cli version
5.3.0
All supporting files (including this script) are contained in the attached file issue.zip
Steps to reproduce
unzip issue.zip
cd issue; ./generate.sh
output/generated/com/example/api/models/Bird.kt
Related issues/PRs
N/A
Suggest a fix
The bug exists in
5.3.0
, the issue is not present in5.2.1