OpenAPITools / OpenAPITools/openapi-generator
[BUG] Handled edge cases where a map can have predefined keys
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
this schema is an edge case of a dynamic map with some keys defined beforehand, but it doesn't get handled very well in the generator
"properties": {
"extraProperties": {
"type": "object",
"properties": {
"A": {
"$ref": "#/components/schemas/AType"
},
"B": {
"$ref": "#/components/schemas/BType"
},
"C": {
"$ref": "#/components/schemas/CType"
}
},
"additionalProperties": { },
"nullable": true,
"readOnly": true
},
"id": {
"type": "string",
"format": "uuid"
},
}
the generator defines a new model for the extra properties, but sets its isModel: false , isContainer: false, isMap: false
I think it should assign all of them to true
openapi-generator version
6.0.0
cc @wing328 since it might be a core issue that affects all generators
@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)
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 the supplied OpenAPI schema in the generator and trace how the model for extraProperties is created. Verify that the generated model is classified as a model, container, and map, and add or update coverage for this schema if the relevant test location can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100