OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using a property of type "object" the generated code uses Kotlin type "Any" which is incorrect. This is because this would allow setting the property to any value on Kotlin side - for example a string. Setting the value to a string is though not in bounds of the given type in the spec, as an "object" should always be a list of properties and their values.
I would expect that using a type "object" generates a Map<String, Any?> as type in Kotlin instead.
Bug Report Checklist
Description
When using a property of type "object" the generated code uses Kotlin type "Any" which is incorrect. This is because this would allow setting the property to any value on Kotlin side - for example a string. Setting the value to a string is though not in bounds of the given type in the spec, as an "object" should always be a list of properties and their values.
I would expect that using a type "object" generates a
Map<String, Any?>
as type in Kotlin instead.openapi-generator version
7.7.0
OpenAPI declaration file content or url
Generation Details
Language: Kotlin
Steps to reproduce
No special steps needed, just generate the model for the spec above.
Related issues/PRs
None - or at least I couldn't find one.
Suggest a fix
I can only tell that the generator for Go does this correctly and generates a
map[string]interface{}
for type "object".