-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Dart - update generator to support null safety #10637
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work 🤩
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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 |
{{/isMap}} | ||
{{^isMap}} | ||
{{#isNumber}} | ||
{{{name}}}: json[r'{{{baseName}}}'] == null | ||
? null | ||
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), | ||
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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