diff --git a/bin/configs/rust-reqwest-trait-petstore.yaml b/bin/configs/rust-reqwest-trait-petstore.yaml index 30190bf0c46e..cf50d56d9eca 100644 --- a/bin/configs/rust-reqwest-trait-petstore.yaml +++ b/bin/configs/rust-reqwest-trait-petstore.yaml @@ -5,7 +5,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/rust additionalProperties: topLevelApiClient: true - packageName: petstore-reqwest + packageName: petstore-reqwest-trait mockall: true enumNameMappings: delivered: shipped diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest-trait/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest-trait/api.mustache index dc0ba75f17cd..113cb70dbb55 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest-trait/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest-trait/api.mustache @@ -245,6 +245,7 @@ impl {{classname}} for {{classname}}Client { _ => local_var_req_builder.query(&[("{{{baseName}}}", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; {{/isArray}} + {{^isArray}} {{#isDeepObject}} {{^isExplode}} let params = crate::apis::parse_deep_object("{{{baseName}}}", &serde_json::to_value(param_value)?); @@ -276,6 +277,7 @@ impl {{classname}} for {{classname}}Client { {{/isModel}} {{/isObject}} {{/isDeepObject}} + {{/isArray}} } {{/required}} {{/queryParams}} diff --git a/samples/client/petstore/rust/Cargo.toml b/samples/client/petstore/rust/Cargo.toml index 90aec2be42a2..6e321f4f13a2 100644 --- a/samples/client/petstore/rust/Cargo.toml +++ b/samples/client/petstore/rust/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members = ["hyper/*", "reqwest/*"] +members = ["hyper/*", "reqwest/*", "reqwest-trait/*"] resolver = "2" diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml index dc371c0e02f0..559e3612bfa4 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "petstore-reqwest" +name = "petstore-reqwest-trait" version = "1.0.0" authors = ["OpenAPI Generator team and contributors"] description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters." diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/README.md b/samples/client/petstore/rust/reqwest-trait/petstore/README.md index 7f635bec6768..bc91b201c877 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/README.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/README.md @@ -1,4 +1,4 @@ -# Rust API client for petstore-reqwest +# Rust API client for petstore-reqwest-trait This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -14,10 +14,10 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat ## Installation -Put the package under your project folder in a directory named `petstore-reqwest` and add the following to `Cargo.toml` under `[dependencies]`: +Put the package under your project folder in a directory named `petstore-reqwest-trait` and add the following to `Cargo.toml` under `[dependencies]`: ``` -petstore-reqwest = { path = "./petstore-reqwest" } +petstore-reqwest-trait = { path = "./petstore-reqwest-trait" } ``` ## Documentation for API Endpoints diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs index 67a10a2ba86f..01ca14659339 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs @@ -174,7 +174,6 @@ impl PetApi for PetApiClient { "multi" => local_var_req_builder.query(¶m_value.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("type", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; - local_var_req_builder = local_var_req_builder.query(&[("type", ¶m_value.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());