Skip to content
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

[Rust] Client library choice between hyper and reqwest #1258

Merged
merged 19 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ef0a2a2
Port of PR https://github.com/swagger-api/swagger-codegen/pull/8804.
bcourtine Oct 17, 2018
aac88a5
Correction of conflict with PR #528 (missing template file).
bcourtine Oct 17, 2018
a347327
Add rust-reqwest samples to Circle CI tests.
bcourtine Oct 17, 2018
7b4dfc2
Add integration test pom.xml file with launcher to trigger cargo exec…
bcourtine Oct 17, 2018
e7c99c5
Deduplicate Maven project name.
bcourtine Oct 17, 2018
3c7c52a
Fix "api_key" header for Petstore.
bcourtine Oct 17, 2018
0ef969d
Better API key management.
bcourtine Oct 18, 2018
a1c865c
Fix query param for lists of objects other than strings (numbers, etc.).
bcourtine Oct 19, 2018
e5f514a
Update to reqwest 0.9, and refactor of header management (using reqwe…
bcourtine Oct 21, 2018
970f996
Merge scripts generating rust-hyper and rust-reqwest samples.
bcourtine Oct 22, 2018
556231e
Consistent full stops.
bcourtine Oct 22, 2018
457ff19
Use raw variables in all Rust mustache templates.
bcourtine Oct 22, 2018
9327601
Replace production build in CI with a quick simple check.
bcourtine Oct 22, 2018
0b1f506
Update samples.
bcourtine Oct 22, 2018
0eff82b
Finish Reqwest 0.9 migration (removing "hyper 0.11" transition feature).
bcourtine Oct 22, 2018
595a4fc
Configuration implements Default trait.
bcourtine Oct 22, 2018
4208034
API template reorganized: HashMap is not required anymore.
bcourtine Oct 22, 2018
e13b3e1
Revert "Merge scripts generating rust-hyper and rust-reqwest samples."
bcourtine Oct 23, 2018
605f950
Remove deprecated "-XX:MaxPermSize" java arg.
bcourtine Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl {{classname}} for {{classname}}Client {
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
{{#queryParams}}
query.append_pair("{{baseName}}", &{{paramName}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
query.append_pair("{{baseName}}", &{{paramName}}{{#isListContainer}}.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

For bonus points, you could use into_iter instead of iter. As I understand it, iter produces references to p, and to_string will therefore clone p. into_iter would give you an owned p, and thus to_string would not clone..

{{/queryParams}}
{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}
for (key, val) in &auth_query {
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/rust-reqwest/src/apis/pet_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl PetApi for PetApiClient {

let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
query.append_pair("status", &status.join(",").to_string());
query.append_pair("status", &status.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string());

query.finish()
};
Expand Down Expand Up @@ -169,7 +169,7 @@ impl PetApi for PetApiClient {

let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
query.append_pair("tags", &tags.join(",").to_string());
query.append_pair("tags", &tags.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string());

query.finish()
};
Expand Down