diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 1ace0e10ef23..d8d58cd588b8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -52,12 +52,15 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.templating.mustache.ReplaceAllLambda; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Template; import io.swagger.v3.oas.models.media.Discriminator; @@ -692,4 +695,14 @@ public String toDefaultValue(Schema p) { return null; } } + + @Override + protected ImmutableMap.Builder addMustacheLambdas() { + return super.addMustacheLambdas() + // Convert variable names to lifetime names. + // Generally they are the same, but `#` is not valid in lifetime names. + // Rust uses `r#` prefix for variables that are also keywords. + .put("lifetimeName", new ReplaceAllLambda("^r#", "r_")); + } + } 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 d3569d622b43..01279915e7e8 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 @@ -22,7 +22,7 @@ pub trait {{{classname}}}: Send + Sync { 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>>; {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}} - 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>>; + 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>>; {{/vendorExtensions.x-group-parameters}} {{/operation}} {{/operations}} @@ -86,7 +86,7 @@ impl {{classname}} for {{classname}}Client { {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}} - 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>> { + 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>> { {{/vendorExtensions.x-group-parameters}} let local_var_configuration = &self.configuration; diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml index 73022c251f9b..e193a3bc5902 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml @@ -95,6 +95,22 @@ paths: - pending - sold default: available + - name: type + in: query + description: Make sure that Rust keywords like type work as query params + required: false + style: form + explode: false + deprecated: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available responses: '200': description: successful operation diff --git a/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md b/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md index 6d542705f058..24c616371e17 100644 --- a/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs index be6a699465c3..eff676820f47 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs @@ -39,7 +39,7 @@ impl PetApiClient pub trait PetApi: Send + Sync { fn add_pet(&self, pet: models::Pet) -> Pin> + Send>>; fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin> + Send>>; - fn find_pets_by_status(&self, status: Vec) -> Pin, Error>> + Send>>; + fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>> + Send>>; fn find_pets_by_tags(&self, tags: Vec) -> Pin, Error>> + Send>>; fn get_pet_by_id(&self, pet_id: i64) -> Pin> + Send>>; fn update_pet(&self, pet: models::Pet) -> Pin> + Send>>; @@ -74,11 +74,15 @@ implPetApi for PetApiClient } #[allow(unused_mut)] - fn find_pets_by_status(&self, status: Vec) -> Pin, Error>> + Send>> { + fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>> + Send>> { let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string()) .with_auth(__internal_request::Auth::Oauth) ; req = req.with_query_param("status".to_string(), status.join(",").to_string()); + if let Some(ref s) = r#type { + let query_value = s.iter().map(|s| s.to_string()).collect::>().join(","); + req = req.with_query_param("type".to_string(), query_value); + } req.execute(self.configuration.borrow()) } diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md b/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs index a81f12916812..ff4fadea86a1 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs @@ -38,7 +38,7 @@ impl PetApiClient pub trait PetApi { fn add_pet(&self, pet: models::Pet) -> Pin>>>; fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin>>>; - fn find_pets_by_status(&self, status: Vec) -> Pin, Error>>>>; + fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>>>>; fn find_pets_by_tags(&self, tags: Vec) -> Pin, Error>>>>; fn get_pet_by_id(&self, pet_id: i64) -> Pin>>>; fn update_pet(&self, pet: models::Pet) -> Pin>>>; @@ -73,11 +73,15 @@ implPetApi for PetApiClient } #[allow(unused_mut)] - fn find_pets_by_status(&self, status: Vec) -> Pin, Error>>>> { + fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>>>> { let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string()) .with_auth(__internal_request::Auth::Oauth) ; req = req.with_query_param("status".to_string(), status.join(",").to_string()); + if let Some(ref s) = r#type { + let query_value = s.iter().map(|s| s.to_string()).collect::>().join(","); + req = req.with_query_param("type".to_string(), query_value); + } req.execute(self.configuration.borrow()) } diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type 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 2f937c1719fd..83ff7127e02b 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 @@ -23,7 +23,7 @@ use super::{Error, configuration}; pub trait PetApi: Send + Sync { async fn add_pet<'pet>(&self, pet: models::Pet) -> Result>; async fn delete_pet<'pet_id, 'api_key>(&self, pet_id: i64, api_key: Option<&'api_key str>) -> Result<(), Error>; - async fn find_pets_by_status<'status>(&self, status: Vec) -> Result, Error>; + async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec, r#type: Option>) -> Result, Error>; async fn find_pets_by_tags<'tags>(&self, tags: Vec) -> Result, Error>; async fn get_pet_by_id<'pet_id>(&self, pet_id: i64) -> Result>; async fn update_pet<'pet>(&self, pet: models::Pet) -> Result>; @@ -112,7 +112,7 @@ impl PetApi for PetApiClient { } /// Multiple status values can be provided with comma separated strings - async fn find_pets_by_status<'status>(&self, status: Vec) -> Result, Error> { + async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec, r#type: Option>) -> Result, Error> { let local_var_configuration = &self.configuration; let local_var_client = &local_var_configuration.client; @@ -124,6 +124,12 @@ impl PetApi for PetApiClient { "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs index 471556f03bd7..9711d3819bce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs @@ -33,7 +33,9 @@ pub struct DeletePetParams { #[derive(Clone, Debug)] pub struct FindPetsByStatusParams { /// Status values that need to be considered for filter - pub status: Vec + pub status: Vec, + /// Make sure that Rust keywords like type work as query params + pub r#type: Option> } /// 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 // unbox the parameters let status = params.status; + let r#type = params.r#type; let local_var_client = &local_var_configuration.client; @@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs index 55fffa82b61a..45676bd82262 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs @@ -33,7 +33,9 @@ pub struct DeletePetParams { #[derive(Clone, Debug)] pub struct FindPetsByStatusParams { /// Status values that need to be considered for filter - pub status: Vec + pub status: Vec, + /// Make sure that Rust keywords like type work as query params + pub r#type: Option> } /// 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 // unbox the parameters let status = params.status; + let r#type = params.r#type; let local_var_client = &local_var_configuration.client; @@ -311,6 +314,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs index 471556f03bd7..9711d3819bce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs @@ -33,7 +33,9 @@ pub struct DeletePetParams { #[derive(Clone, Debug)] pub struct FindPetsByStatusParams { /// Status values that need to be considered for filter - pub status: Vec + pub status: Vec, + /// Make sure that Rust keywords like type work as query params + pub r#type: Option> } /// 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 // unbox the parameters let status = params.status; + let r#type = params.r#type; let local_var_client = &local_var_configuration.client; @@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs index 471556f03bd7..9711d3819bce 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs @@ -33,7 +33,9 @@ pub struct DeletePetParams { #[derive(Clone, Debug)] pub struct FindPetsByStatusParams { /// Status values that need to be considered for filter - pub status: Vec + pub status: Vec, + /// Make sure that Rust keywords like type work as query params + pub r#type: Option> } /// 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 // unbox the parameters let status = params.status; + let r#type = params.r#type; let local_var_client = &local_var_configuration.client; @@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs index 3bd8113f7bde..34cbc404de0a 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs @@ -176,7 +176,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api } /// Multiple status values can be provided with comma separated strings -pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec) -> Result, Error> { +pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec, r#type: Option>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -188,6 +188,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + }; + } if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key { let local_var_new_headers = match local_var_aws_v4_key.sign( &local_var_uri_str, diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md index a0b77436523a..043435fd7d35 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs index b16d781edcf8..7e57307d321a 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs @@ -150,7 +150,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api } /// Multiple status values can be provided with comma separated strings -pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec) -> Result, Error> { +pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec, r#type: Option>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -162,6 +162,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); } diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md index d503facb903c..8dbe351bda07 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md @@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes ## find_pets_by_status -> Vec find_pets_by_status(status) +> Vec find_pets_by_status(status, r#type) Finds Pets by status Multiple status values can be provided with comma separated strings @@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] | +**r#type** | Option<[**Vec**](String.md)> | Make sure that Rust keywords like type work as query params | | ### Return type diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index a08c09aaa3cc..ee502419401a 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -150,7 +150,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api } /// Multiple status values can be provided with comma separated strings -pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec) -> Result, Error> { +pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec, r#type: Option>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -162,6 +162,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + if let Some(ref local_var_str) = r#type { + local_var_req_builder = match "csv" { + "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").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()); }