-
Notifications
You must be signed in to change notification settings - Fork 536
support for params having multiple values #681
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: main
Are you sure you want to change the base?
Conversation
@ashitaprasad I am familiar with the codebase; however, I need to explore the test files further before making the necessary updates. I plan to work on that after updating codegen for all languages. In the meantime, please review the implementation and share your feedback. |
@animator I request you to take a look(Feedback on the major changes is enough) . I've updated the code generation for all supported languages to handle parameters with multiple values. Before I move on to writing/updating tests, I just want to ensure that all changes are aligned with expectations . |
@@ -34,14 +34,28 @@ class HttpRequestModel with _$HttpRequestModel { | |||
_$HttpRequestModelFromJson(json); | |||
|
|||
Map<String, String> get headersMap => rowsToMap(headers) ?? {}; | |||
Map<String, String> get paramsMap => rowsToMap(params) ?? {}; | |||
Map<String, dynamic> get paramsMap => rowsToRequestMap(params) ?? {}; |
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.
params map should have a strict datatype - Map<String, List>
List<NameValueModel>? get enabledHeaders => | ||
getEnabledRows(headers, isHeaderEnabledList); | ||
List<NameValueModel>? get enabledParams => | ||
getEnabledRows(params, isParamEnabledList); | ||
|
||
Map<String, String> get enabledHeadersMap => rowsToMap(enabledHeaders) ?? {}; | ||
Map<String, String> get enabledParamsMap => rowsToMap(enabledParams) ?? {}; | ||
Map<String, dynamic> get enabledParamsMap { |
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.
same for enabled params
lib/widgets/table_request.dart
Outdated
@@ -12,7 +12,7 @@ class RequestDataTable extends StatelessWidget { | |||
this.valueName, | |||
}); | |||
|
|||
final Map<String, String> rows; | |||
final Map<String, dynamic> rows; |
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.
This can no longer be a map
@badnikhil do not conversations as resolved. You have to comment if you have fixed it, then the reviewer verifies the fix and marks it is resolved. |
Sorry about that, I’ll keep it in mind from now on. |
@animator i have resolved the datatypes.. Also updated a widget test. |
431 tests failed |
Tests for Codegen are not updated yet(as mentioned earlier )..
Updated it to List,adding commit . |
The approach has been reviewed. Please fix all the codegen tests so that the PR can be merged. |
Updating as soon as possible |
Also, why major code changes have been made to codegens? |
URL inside the swift code ->"https://postman-echo.com/get?param2=value4¶m1=v2" Explanation -> So, an issue when we have multiple values for same key... codegen needs to be updated for the enhancement intended in this PR
Here the changes can be made more easily If you want params directly added to URL instead of handling seperately inside code Then the changes can be significantly reduced.. |
Thanks for the explanation. |
PR Description
The request parameters were previously handled as a
Map<String, String>
. I have updated this toMap<String, List<string>
to support multiple valuesAdditionally, I have modified the relevant implementations to accommodate this change.
Related Issues
Checklist
main
branch before creating this PR.flutter upgrade
verified).flutter test
), and they pass successfully.Added/Updated Tests?
We encourage contributors to add relevant test cases.
Development & Testing Environment