Skip to content

Commit 3cb2ea3

Browse files
ranger-rosstimon-sbr
authored andcommitted
[Rust] Fixed rust keyword params in reqwest-trait library (OpenAPITools#20333)
* Fixed rust keywords in reqwest-trait lib * Update tests and samples
1 parent a4b94a5 commit 3cb2ea3

File tree

23 files changed

+132
-25
lines changed

23 files changed

+132
-25
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java

+13
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,15 @@
5252
import org.openapitools.codegen.model.ModelsMap;
5353
import org.openapitools.codegen.model.OperationMap;
5454
import org.openapitools.codegen.model.OperationsMap;
55+
import org.openapitools.codegen.templating.mustache.ReplaceAllLambda;
5556
import org.openapitools.codegen.utils.ModelUtils;
5657
import org.openapitools.codegen.utils.StringUtils;
5758
import org.slf4j.Logger;
5859
import org.slf4j.LoggerFactory;
5960

61+
import com.google.common.collect.ImmutableMap;
6062
import com.samskivert.mustache.Mustache;
63+
import com.samskivert.mustache.Mustache.Lambda;
6164
import com.samskivert.mustache.Template;
6265

6366
import io.swagger.v3.oas.models.media.Discriminator;
@@ -692,4 +695,14 @@ public String toDefaultValue(Schema p) {
692695
return null;
693696
}
694697
}
698+
699+
@Override
700+
protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
701+
return super.addMustacheLambdas()
702+
// Convert variable names to lifetime names.
703+
// Generally they are the same, but `#` is not valid in lifetime names.
704+
// Rust uses `r#` prefix for variables that are also keywords.
705+
.put("lifetimeName", new ReplaceAllLambda("^r#", "r_"));
706+
}
707+
695708
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub trait {{{classname}}}: Send + Sync {
2222
async fn {{{operationId}}}(&self, {{#allParams}}{{#-first}} params: {{{operationIdCamelCase}}}Params {{/-first}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
2323
{{/vendorExtensions.x-group-parameters}}
2424
{{^vendorExtensions.x-group-parameters}}
25-
async fn {{{operationId}}}<{{#allParams}}'{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{{paramName}}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
25+
async fn {{{operationId}}}<{{#allParams}}'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
2626
{{/vendorExtensions.x-group-parameters}}
2727
{{/operation}}
2828
{{/operations}}
@@ -86,7 +86,7 @@ impl {{classname}} for {{classname}}Client {
8686

8787
{{/vendorExtensions.x-group-parameters}}
8888
{{^vendorExtensions.x-group-parameters}}
89-
async fn {{{operationId}}}<{{#allParams}}'{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{{paramName}}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
89+
async fn {{{operationId}}}<{{#allParams}}'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
9090
{{/vendorExtensions.x-group-parameters}}
9191
let local_var_configuration = &self.configuration;
9292

modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ paths:
9595
- pending
9696
- sold
9797
default: available
98+
- name: type
99+
in: query
100+
description: Make sure that Rust keywords like type work as query params
101+
required: false
102+
style: form
103+
explode: false
104+
deprecated: true
105+
schema:
106+
type: array
107+
items:
108+
type: string
109+
enum:
110+
- available
111+
- pending
112+
- sold
113+
default: available
98114
responses:
99115
'200':
100116
description: successful operation

samples/client/petstore/rust/hyper/petstore/docs/PetApi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
7878

7979
## find_pets_by_status
8080

81-
> Vec<models::Pet> find_pets_by_status(status)
81+
> Vec<models::Pet> find_pets_by_status(status, r#type)
8282
Finds Pets by status
8383

8484
Multiple status values can be provided with comma separated strings
@@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
8989
Name | Type | Description | Required | Notes
9090
------------- | ------------- | ------------- | ------------- | -------------
9191
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
92+
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
9293

9394
### Return type
9495

samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<C: Connect> PetApiClient<C>
3939
pub trait PetApi: Send + Sync {
4040
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>>;
4141
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
42-
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>>;
42+
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>>;
4343
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>>;
4444
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>>;
4545
fn update_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>>;
@@ -74,11 +74,15 @@ impl<C: Connect>PetApi for PetApiClient<C>
7474
}
7575

7676
#[allow(unused_mut)]
77-
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>> {
77+
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>> {
7878
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string())
7979
.with_auth(__internal_request::Auth::Oauth)
8080
;
8181
req = req.with_query_param("status".to_string(), status.join(",").to_string());
82+
if let Some(ref s) = r#type {
83+
let query_value = s.iter().map(|s| s.to_string()).collect::<Vec<String>>().join(",");
84+
req = req.with_query_param("type".to_string(), query_value);
85+
}
8286

8387
req.execute(self.configuration.borrow())
8488
}

samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
7878

7979
## find_pets_by_status
8080

81-
> Vec<models::Pet> find_pets_by_status(status)
81+
> Vec<models::Pet> find_pets_by_status(status, r#type)
8282
Finds Pets by status
8383

8484
Multiple status values can be provided with comma separated strings
@@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
8989
Name | Type | Description | Required | Notes
9090
------------- | ------------- | ------------- | ------------- | -------------
9191
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
92+
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
9293

9394
### Return type
9495

samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<C: hyper::client::connect::Connect> PetApiClient<C>
3838
pub trait PetApi {
3939
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
4040
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
41-
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
41+
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
4242
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
4343
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
4444
fn update_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
@@ -73,11 +73,15 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
7373
}
7474

7575
#[allow(unused_mut)]
76-
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> {
76+
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> {
7777
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string())
7878
.with_auth(__internal_request::Auth::Oauth)
7979
;
8080
req = req.with_query_param("status".to_string(), status.join(",").to_string());
81+
if let Some(ref s) = r#type {
82+
let query_value = s.iter().map(|s| s.to_string()).collect::<Vec<String>>().join(",");
83+
req = req.with_query_param("type".to_string(), query_value);
84+
}
8185

8286
req.execute(self.configuration.borrow())
8387
}

samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
7878

7979
## find_pets_by_status
8080

81-
> Vec<models::Pet> find_pets_by_status(status)
81+
> Vec<models::Pet> find_pets_by_status(status, r#type)
8282
Finds Pets by status
8383

8484
Multiple status values can be provided with comma separated strings
@@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
8989
Name | Type | Description | Required | Notes
9090
------------- | ------------- | ------------- | ------------- | -------------
9191
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
92+
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
9293

9394
### Return type
9495

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use super::{Error, configuration};
2323
pub trait PetApi: Send + Sync {
2424
async fn add_pet<'pet>(&self, pet: models::Pet) -> Result<models::Pet, Error<AddPetError>>;
2525
async fn delete_pet<'pet_id, 'api_key>(&self, pet_id: i64, api_key: Option<&'api_key str>) -> Result<(), Error<DeletePetError>>;
26-
async fn find_pets_by_status<'status>(&self, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>>;
26+
async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>>;
2727
async fn find_pets_by_tags<'tags>(&self, tags: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByTagsError>>;
2828
async fn get_pet_by_id<'pet_id>(&self, pet_id: i64) -> Result<models::Pet, Error<GetPetByIdError>>;
2929
async fn update_pet<'pet>(&self, pet: models::Pet) -> Result<models::Pet, Error<UpdatePetError>>;
@@ -112,7 +112,7 @@ impl PetApi for PetApiClient {
112112
}
113113

114114
/// Multiple status values can be provided with comma separated strings
115-
async fn find_pets_by_status<'status>(&self, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
115+
async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
116116
let local_var_configuration = &self.configuration;
117117

118118
let local_var_client = &local_var_configuration.client;
@@ -124,6 +124,12 @@ impl PetApi for PetApiClient {
124124
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
125125
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
126126
};
127+
if let Some(ref local_var_str) = r#type {
128+
local_var_req_builder = match "csv" {
129+
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
130+
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
131+
};
132+
}
127133
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
128134
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
129135
}

samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
7878

7979
## find_pets_by_status
8080

81-
> Vec<models::Pet> find_pets_by_status(status)
81+
> Vec<models::Pet> find_pets_by_status(status, r#type)
8282
Finds Pets by status
8383

8484
Multiple status values can be provided with comma separated strings
@@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
8989
Name | Type | Description | Required | Notes
9090
------------- | ------------- | ------------- | ------------- | -------------
9191
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
92+
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
9293

9394
### Return type
9495

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ pub struct DeletePetParams {
3333
#[derive(Clone, Debug)]
3434
pub struct FindPetsByStatusParams {
3535
/// Status values that need to be considered for filter
36-
pub status: Vec<String>
36+
pub status: Vec<String>,
37+
/// Make sure that Rust keywords like type work as query params
38+
pub r#type: Option<Vec<String>>
3739
}
3840

3941
/// struct for passing parameters to the method [`find_pets_by_tags`]
@@ -296,6 +298,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
296298

297299
// unbox the parameters
298300
let status = params.status;
301+
let r#type = params.r#type;
299302

300303

301304
let local_var_client = &local_var_configuration.client;
@@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
307310
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
308311
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
309312
};
313+
if let Some(ref local_var_str) = r#type {
314+
local_var_req_builder = match "csv" {
315+
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
316+
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
317+
};
318+
}
310319
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
311320
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
312321
}

samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
7878

7979
## find_pets_by_status
8080

81-
> Vec<models::Pet> find_pets_by_status(status)
81+
> Vec<models::Pet> find_pets_by_status(status, r#type)
8282
Finds Pets by status
8383

8484
Multiple status values can be provided with comma separated strings
@@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
8989
Name | Type | Description | Required | Notes
9090
------------- | ------------- | ------------- | ------------- | -------------
9191
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
92+
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
9293

9394
### Return type
9495

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ pub struct DeletePetParams {
3333
#[derive(Clone, Debug)]
3434
pub struct FindPetsByStatusParams {
3535
/// Status values that need to be considered for filter
36-
pub status: Vec<String>
36+
pub status: Vec<String>,
37+
/// Make sure that Rust keywords like type work as query params
38+
pub r#type: Option<Vec<String>>
3739
}
3840

3941
/// struct for passing parameters to the method [`find_pets_by_tags`]
@@ -300,6 +302,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
300302

301303
// unbox the parameters
302304
let status = params.status;
305+
let r#type = params.r#type;
303306

304307

305308
let local_var_client = &local_var_configuration.client;
@@ -311,6 +314,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
311314
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
312315
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
313316
};
317+
if let Some(ref local_var_str) = r#type {
318+
local_var_req_builder = match "csv" {
319+
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
320+
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
321+
};
322+
}
314323
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
315324
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
316325
}

0 commit comments

Comments
 (0)