-
Notifications
You must be signed in to change notification settings - Fork 6k
dart: fix required params. add 'multi' query params. better deserialization. #3325
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
Merged
wing328
merged 6 commits into
swagger-api:master
from
d3v-cl:rmCrypto_fixRequiredParams_useAsyncAwait_addMultiQueryParams
Jul 13, 2016
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0466405
fix: verification of requiredParams now works
9a65a5f
feat: improve / fix deserialization by parsing type String
999ef42
doc: explain how to run tests
0d0d353
feat dart: mv basePath to ApiClient
d3v-cl a5351f7
feat dart: add pubName to library name.
d3v-cl 8003156
feat dart: add pubName to all remaining library parts
d3v-cl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...main/resources/dart/apiException.mustache → ...ain/resources/dart/api_exception.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| part of api; | ||
| part of {{pubName}}.api; | ||
|
|
||
| class ApiException implements Exception { | ||
| int code = 0; | ||
|
|
||
33 changes: 33 additions & 0 deletions
33
modules/swagger-codegen/src/main/resources/dart/api_helper.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| part of {{pubName}}.api; | ||
|
|
||
| const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; | ||
|
|
||
| // port from Java version | ||
| List<QueryParam> _convertParametersForCollectionFormat( | ||
| String collectionFormat, String name, dynamic value) { | ||
| var params = []; | ||
|
|
||
| // preconditions | ||
| if (name == null || name.isEmpty || value == null) return params; | ||
|
|
||
| if (value is! List) { | ||
| params.add(new QueryParam(name, value as String)); | ||
| return params; | ||
| } | ||
|
|
||
| List<String> values = value as List<String>; | ||
|
|
||
| // get the collection format | ||
| collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) | ||
| ? "csv" | ||
| : collectionFormat; // default: csv | ||
|
|
||
| if (collectionFormat == "multi") { | ||
| return values.map((v) => new QueryParam(name, v)); | ||
| } | ||
|
|
||
| String delimiter = _delimiters[collectionFormat] ?? ","; | ||
|
|
||
| params.add(new QueryParam(name, values.join(delimiter))); | ||
| return params; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You may want to create another dart petstore shell script (e.g. dart-vmlib-petstore.sh) for the
--additional-properties browserClient=falseoption (similar to what we've done for other langauges, e.g. java)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.
And you may consider later adding a CLI option (e.g. dartBrowserClient) instead of using additional properties.