OpenAPITools / OpenAPITools/openapi-generator
[BUG] Kotlin generated class for `type: object` with `additionalProperties` does not compile
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
OpenApi allows to define an open ended object (map). When generating Kotlin code for it, the class declaration contains a compile error.
data class Metadata(...) : kotlin.collections.HashMap<String, kotlin.String>{ is generated, but it should be:
data class Metadata(...) : kotlin.collections.HashMap<String, kotlin.String>(){.
openapi-generator version
6.0.0 / 6.0.1
OpenAPI declaration file content or url
Spec:
components:
schemas:
Metadata:
type: "object"
properties:
customerIp:
type: "string"
additionalProperties:
type: "string"
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing Kotlin generation with the supplied OpenAPI schema and inspect the generated Metadata declaration. Compare the emitted HashMap inheritance syntax with the expected constructor form; done when the generated Kotlin compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100