OpenAPITools / OpenAPITools/openapi-generator
[BUG][Dart] Getting Map<String, Object> instead of Map<String, dynamic>
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I want to generate Map<String, dynamic> type but I'm getting Map<String, Object> instead. I'm talking about the initMap property in lib/models/device.dart. If I understood this part of the specification correctly, free-form objects can be anything (numbers, strings etc.) so the Object type is not correct. If I misunderstood it, is it possible to have dynamic type generated? Or why it is not? Thank you
openapi-generator version
Latest v6.6.0 .jar snapshot
OpenAPI declaration file content or url
Here is a gist: https://gist.github.com/Liniik/dca95f3a72e46f9d17544b312a2545aa
Generation Details
I'm using this command to generate the API: java -jar .\openapi-generator-cli-6.6.0-20230510.062557-69.jar generate -i .\openapi.yaml -g dart -o ./api
Steps to reproduce
From the given specification in the gist above, generate files via command in the paragraph above.
Related issues/PRs
Maybe #12165 could be somewhat related to it. But it was resolved so I don't know...
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
Reproduce the issue with the linked OpenAPI declaration and the documented Java generation command, then inspect the generated lib/models/device.dart file and its initMap property. Trace the Dart generator or template that determines this map value type and verify the result against the OpenAPI free-form object semantics. Done means the generated type matches the intended dynamic map type and relevant generation tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100