-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[BUG][dart-dio] optimize parameterToString to convert DateTime correctly #8271
Comments
If it is a |
no, even bool isn't serialized correctly |
Yea we should not serialize primitives with a serializer. |
Can you please review and possibly test the PR |
If no specific serializer is used, built_value will add a discriminator field and make it a JSON object. |
I think the issue here is that built_value should have handled primitives better than this, serialization shouldn't be so over-complicated. |
In any case, for |
I have update the PR and added tests, can you check if that solves your issues? |
I have been using my own templates, and I believe they solve most of the issues that I came across https://github.com/Bdaya-Dev/Custom-Openapi-Templates They have been tested on multiple specifications too |
Ok so I have not thought about collections. Looking at the Dio FormData implementation makes a couple things clearer: https://github.com/flutterchina/dio/blob/master/dio/lib/src/utils.dart#L34 It seems your |
the problem is the way backend handles requests, some want it to be |
same reason I introduced |
I think #8372 could solve most of it. We can not currently support custom collection formats. I added tests to ensure collections and date time is correctly encoded in the Dio |
After adding more tests, I noticed that this is also a question of |
most of them are |
Both should now work with collections and |
A way to handle collection formats has been added to dio 4.0.0. If you need different formats in one route you might want to comment on cfug/dio#799 and follow #6681 Otherwise I think this issue can be closed. |
The |
* add support for collectionFormat in query parameters and www-url-encoded content * add tests * remove empty query parameter maps from generated code * closes OpenAPITools#6681 * closes OpenAPITools#9522 * closes OpenAPITools#8271 (the last remaining parts)
…9635) * [dart][dart-dio] Add support for query collection parameter format * add support for collectionFormat in query parameters and www-url-encoded content * add tests * remove empty query parameter maps from generated code * closes #6681 * closes #9522 * closes #8271 (the last remaining parts) * Fix formatting
Description
Currently DateTime is being converted to string using normal .ToString()
Ref:
openapi-generator/modules/openapi-generator/src/main/resources/dart-dio/api_util.mustache
Lines 6 to 14 in c322084
instead,
toIso8601String
should be usedopenapi-generator version
V5.0.0
Suggested fix:
The text was updated successfully, but these errors were encountered: