-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][DART] Method listFromJson isn't defined on array of enums #4887
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Also running into this. |
The method that is not implemented and is implemented on other models should be like: static List<ChunkState> listFromJson(List<dynamic> json) {
return json == null ? List<ChunkState>() : json.map((value) => ChunkState.fromJson(value)).toList();
} I'm not sure why this is not implemented, but looking at the mustache files dart/class.mustache I found: static List<{{classname}}> listFromJson(List<dynamic> json) {
return json == null ? new List<{{classname}}>() : json.map((value) => new {{classname}}.fromJson(value)).toList();
} So maybe we need only to add this code on dart/enum.mustache ? Something like that (i'm not able to do the checklist to make a PR right now...) |
I created the PR but modifying the template inside |
I keep hitting this myself too. Any good ways to solve this? |
Please merge my PR (is not merged on master yet) |
@selankon thanks for the fix, which has been merged into the master. Have a nice weekend. |
Also have this issue, seems it's still not updated from 2020? Anyway to fix it? 😢 |
Description
When I define inside an object a property that is an array of enums, the generated code call a method
listFromJson
that is not defined inside the enum model causing build problems.openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Just copy the .yml definition and run the command.
After the code is generated be sure that all the dependencies are installed. I us VSCodium with Dart extension for that.
Once all installed you will see a build error on lib/model/file_chunks_info.dart.
Where
listFromJson
is not defined onChunkState
model.Related issues/PRs
Maybe related to #2567
Suggest a fix
Should the nums have the method
listFromJson
?The text was updated successfully, but these errors were encountered: