[bug][dart][dart-dio] Improve parameterToString handling - #8372
Conversation
|
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
02a2e6e to
246d98c
Compare
* add tests * not sure this is complete but it is better than before and can serve as a baseline with the test cases
246d98c to
364d587
Compare
|
CC @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) |
| _bodyData = {{#isMultipart}}FormData.fromMap({{/isMultipart}}<String, dynamic>{ | ||
| {{#formParams}} | ||
| {{^required}}{{^nullable}}if ({{{paramName}}} != null) {{/nullable}}{{/required}}r'{{{baseName}}}': {{#isFile}}MultipartFile.fromBytes({{{paramName}}}, filename: r'{{{baseName}}}'){{/isFile}}{{^isFile}}parameterToString(_serializers, {{{paramName}}}){{/isFile}}, | ||
| {{^required}}{{^nullable}}if ({{{paramName}}} != null) {{/nullable}}{{/required}}r'{{{baseName}}}': {{#isFile}}MultipartFile.fromBytes({{{paramName}}}, filename: r'{{{baseName}}}'){{/isFile}}{{^isFile}}encodeFormParameter(_serializers, {{{paramName}}}, const FullType({{^isContainer}}{{{baseType}}}{{/isContainer}}{{#isContainer}}Built{{#isMap}}Map{{/isMap}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{baseType}}})]{{/isContainer}})){{/isFile}}, |
There was a problem hiding this comment.
would you sacrifice formatting of generated code to make this easier to read? It's a question, not a request.
There was a problem hiding this comment.
I ask myself this a lot but useful diffing of the generated code kinda seems important.
There was a problem hiding this comment.
Do you commit your autogenerated code to codebase? I'm used to generating it to untracked directories and generating everything in build pipelines. I do it in Java, TS and Dart.
There was a problem hiding this comment.
I do commit it for libraries but not for Flutter apps.
But what I actually mean are the changes in the generated example code in the PRs in this repository.
There was a problem hiding this comment.
Like the diff for the API files in this PR, they are pretty good to read.
Related to #8271
PR checklist
./bin/generate-samples.shto update all Petstore samples related to your fix. 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