Dart - update generator to support null safety#10637
Dart - update generator to support null safety#10637wing328 merged 52 commits intoOpenAPITools:6.0.xfrom
Conversation
|
@jaumard @josh-burton @amondnet @sbu-WBT @kuhnroyal @agilob @ahmednfwela @noordawod any last reviews? can I get green ticks on this PR please? |
|
note: the java changes also affect other generators |
kuhnroyal
left a comment
There was a problem hiding this comment.
Not looking at all the Dart changes, its just too much.
modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
Show resolved
Hide resolved
Yeah, it took almost a day's work to painstakinly test, retest and reshape the changes, hopefully with amicable results for the public. But for me it still works in real-life apps and now it's null safe. |
|
@wing328 can we have this merged to 6.x please! 🎉 |
|
@wing328 pls 👀 |
|
Just merged. Sorry for the delay. |
|
well done everyone :) |
|
Is there an estimate when v6 will be merged to |
|
This month most likely, with 6.0 release |
| {{{name}}}: json[r'{{{baseName}}}'] == null | ||
| ? null | ||
| : {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), | ||
| ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} |
There was a problem hiding this comment.
As far as I can tell, this line isn't quite right. It doesn't handle required num types, which will be (correctly) generated as non-nullable, but then this line tries to set them to null when they don't have a default value which won't compile.
is an example of a spec which exhibits this, specifically:
https://raw.githubusercontent.com/SpaceTradersAPI/api-docs/b52734a2cdb63e796174310ebac89f5009df3b9f/models/JumpGate.json


Targeting 6.x as there's plenty of breaking changes here
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.3.0),6.0.x@jaumard @josh-burton @amondnet @sbu-WBT @kuhnroyal @agilob @ahmednfwela