[Dart] Add configuration to add new generators and add json_serializable#8789
[Dart] Add configuration to add new generators and add json_serializable#8789wing328 merged 23 commits intoOpenAPITools:masterfrom
Conversation
* this change opens us a way to allow adding more than 2 generators
|
@swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) |
specify default serializer
bfb97ae to
bf370a9
Compare
kuhnroyal
left a comment
There was a problem hiding this comment.
I like it a lot.
You should test if the minimum supported Dart version needs to be raised.
And maybe get rid of the new empty lines to reduce noise.
Also add a pom.xml for the json_serializable sample?
json_serializer now has version 4.0.0 which will require updating dart version, but so far this is ok. I don't want to make too many changes at once here. eg. default value isn't support yet here, nor standalone enums, but it's a major move forward I think. It will open way for @k-paxian to add dart-json-mapper serializer in client library. |
|
I am sure not the current approach with the part files will work. Have you run the build runner? I think you are missing the model part files and since only one Maybe we first need to get rid of the current part files and use correct exports. |
Neither I am, but this actually works quite nice. Instead producing really verbose files, one .g.dart for each model it generates one big |
Check commit history... and I give up, the new empty lines are result of I'd rather have nicer mustache template than autogenerated code that shouldn't me modified manually anyway... (and we recommend running dartfmt after generation). You can remove whitespaces from GH review in options. |
|
Travis failing |
|
That is good but I know a lot of generators where this will not work. So we should do that anyway, but then it can be independent of this change. There seems to be some transformer stuff left in the api client and helper that doesnt compile. |
I propose to do it after this change, I find this PR to be too much in one go already. |
Unfortunately this is where we're hitting temporary limitation of json_serializable and for now I can't add this module to pom.xml it doesn't generate mapping for enums that are not used in classes. This is purely temporary as this api-helper and api-client are redundant for this functionality. Each class has its own |
|
I see, so you want this merged to have the basic infrastructure in place although the json_serializable option does not completely work yet. I agree in that regard, maybe we should log some warning when this option is set until it is completely working.
I agree, this is out of scope. |
I'll add default value support after this gets in. It doesn't have to be perfect on the first merge. If you think this looks good, can we get this merged please @kuhnroyal and @wing328 ? |
|
I think changing the enum templates to |
|
Done! |
31da697 to
926515e
Compare
|
@agilob thanks for the PR. Please resolve the merge conflicts when you've time. |
…to dart-json_serializable
|
@wing328 done |
|
@wing328 can we get this in please? I want to add a few more features to this generator while I still have time for it |
|
Just merged. Thanks again for the PR. |

PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master,5.1.x,6.0.x