OpenAPITools / OpenAPITools/openapi-generator
[BUG][DART] Polymorphism for dart-dio broken
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)?
- What's the version of OpenAPI Generator used? 2.0
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
Description
This is a general problem with generated code for dart. Annotated classes with allOf are not identified correctly and generated twice.
For e.g. we have an Dog and Cat inherited from class Pet. The code generator would create
pet.dart
dog.dart
dog_all_off.dart
cat.dart
cat_all_off.dart
To support polymorphism in general, it would be needed to match this built_value example
openapi-generator version
Using latest snapshot 4.3.1.
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli-4.3.1-20200423.060155-118.jar generate -i swagger.json -c config.json -l dart-dio -o .
Steps to reproduce
Generate the code
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 issue with the listed openapi-generator-cli command, swagger.json, and config.json, using the declaration at the linked Pastebin URL. Compare the generated pet.dart, dog.dart, dog_all_off.dart, cat.dart, and cat_all_off.dart files with the intended Pet, Dog, and Cat hierarchy. Done means allOf-derived classes are identified correctly without duplicate generated classes and polymorphism works as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, 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