-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[Dart] Properly handle DateTime arrays using DateTimeHelper extension method #13432
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
base: master
Are you sure you want to change the base?
Conversation
Prior to this change, the dart generator would not properly handle DateTime arrays. Instead, it would generate code that relies on a method that doesn't exist (DateTime.listFromJson). This update adds a DateTimeHelper extension to the api_helper.dart file and uses it anywhere there is a list of DateTimes.
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.
there are alot of whitespace changes that pollute the PR, can you just keep the bare minimum changes?
{{/description}} | ||
{{^isEnum}} | ||
{{#minimum}} | ||
{{#description}} | ||
/// | ||
/// |
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.
are all the whitespace changes necessary?
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.
That was unintentional, I've updated the PR
@@ -150,7 +150,12 @@ class {{{classname}}} { | |||
: null, | |||
{{/items.isArray}} | |||
{{^items.isArray}} | |||
{{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, | |||
{{#items.isDateTime}} |
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.
It would be nice to check here for date types via {{#items.isDate}}
as well.
Any news on this? |
This change addresses #11462.
Prior to this change, the dart generator would not properly handle DateTime arrays. Instead, it would generate code that relies on a method that doesn't exist (DateTime.listFromJson).
This update adds a DateTimeHelper extension to the api_helper.dart file and uses it anywhere there is a list of DateTimes.
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
(6.1.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks)@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)