Skip to content

Commit 3106093

Browse files
authored
Add reqwest-trait crate to workspace and rename it (#21674)
* Add reqwest-trait crate to workspace and rename it * Fix missing ^isArray condition
1 parent 9f2c920 commit 3106093

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

bin/configs/rust-reqwest-trait-petstore.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
55
templateDir: modules/openapi-generator/src/main/resources/rust
66
additionalProperties:
77
topLevelApiClient: true
8-
packageName: petstore-reqwest
8+
packageName: petstore-reqwest-trait
99
mockall: true
1010
enumNameMappings:
1111
delivered: shipped

modules/openapi-generator/src/main/resources/rust/reqwest-trait/api.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ impl {{classname}} for {{classname}}Client {
245245
_ => local_var_req_builder.query(&[("{{{baseName}}}", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
246246
};
247247
{{/isArray}}
248+
{{^isArray}}
248249
{{#isDeepObject}}
249250
{{^isExplode}}
250251
let params = crate::apis::parse_deep_object("{{{baseName}}}", &serde_json::to_value(param_value)?);
@@ -276,6 +277,7 @@ impl {{classname}} for {{classname}}Client {
276277
{{/isModel}}
277278
{{/isObject}}
278279
{{/isDeepObject}}
280+
{{/isArray}}
279281
}
280282
{{/required}}
281283
{{/queryParams}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
2-
members = ["hyper/*", "reqwest/*"]
2+
members = ["hyper/*", "reqwest/*", "reqwest-trait/*"]
33
resolver = "2"

samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "petstore-reqwest"
2+
name = "petstore-reqwest-trait"
33
version = "1.0.0"
44
authors = ["OpenAPI Generator team and contributors"]
55
description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters."

samples/client/petstore/rust/reqwest-trait/petstore/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Rust API client for petstore-reqwest
1+
# Rust API client for petstore-reqwest-trait
22

33
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44

@@ -14,10 +14,10 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
1414

1515
## Installation
1616

17-
Put the package under your project folder in a directory named `petstore-reqwest` and add the following to `Cargo.toml` under `[dependencies]`:
17+
Put the package under your project folder in a directory named `petstore-reqwest-trait` and add the following to `Cargo.toml` under `[dependencies]`:
1818

1919
```
20-
petstore-reqwest = { path = "./petstore-reqwest" }
20+
petstore-reqwest-trait = { path = "./petstore-reqwest-trait" }
2121
```
2222

2323
## Documentation for API Endpoints

samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ impl PetApi for PetApiClient {
174174
"multi" => local_var_req_builder.query(&param_value.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
175175
_ => local_var_req_builder.query(&[("type", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
176176
};
177-
local_var_req_builder = local_var_req_builder.query(&[("type", &param_value.to_string())]);
178177
}
179178
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
180179
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());

0 commit comments

Comments
 (0)