From d671b83a5f818286da06b81f9d875c2d08656968 Mon Sep 17 00:00:00 2001 From: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> Date: Sat, 28 Oct 2023 21:08:39 +0900 Subject: [PATCH] chore(deps,rust): requires reqwest 0.11 in blocking generated code (#16927) * chore(deps,rust): requires reqwest to be 0.11 series even if generate in blocking mode * chore: reflect change * test: reflect blocking Form --- .../openapi-generator/src/main/resources/rust/Cargo.mustache | 4 +++- .../src/main/resources/rust/reqwest/api.mustache | 2 +- .../src/main/resources/rust/reqwest/configuration.mustache | 4 ++-- .../client/others/rust/reqwest-regression-16119/Cargo.toml | 4 +++- .../rust/reqwest-regression-16119/src/apis/configuration.rs | 4 ++-- samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml | 4 +++- .../rust/reqwest/name-mapping/src/apis/configuration.rs | 4 ++-- .../petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml | 4 +++- .../reqwest/petstore-awsv4signature/src/apis/configuration.rs | 4 ++-- .../rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs | 2 +- samples/client/petstore/rust/reqwest/petstore/Cargo.toml | 4 +++- .../petstore/rust/reqwest/petstore/src/apis/configuration.rs | 4 ++-- .../client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs | 2 +- 13 files changed, 28 insertions(+), 18 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache index 2471f2080b9..8c2510345b3 100644 --- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache @@ -54,7 +54,9 @@ secrecy = "0.8.0" {{/withAWSV4Signature}} {{#reqwest}} {{^supportAsync}} -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] {{/supportAsync}} {{#supportAsync}} {{#supportMiddleware}} diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index 5318c580411..3e130bbbc43 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -244,7 +244,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: {{/hasAuthMethods}} {{#isMultipart}} {{#hasFormParams}} - let mut local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest{{^supportAsync}}::blocking{{/supportAsync}}::multipart::Form::new(); {{#formParams}} {{#isFile}} {{^supportAsync}} diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache index 32b2fd8a7c5..0de2884a8bb 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache @@ -11,7 +11,7 @@ use secrecy::{SecretString, ExposeSecret}; pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: {{#supportMiddleware}}reqwest_middleware::ClientWithMiddleware{{/supportMiddleware}}{{^supportMiddleware}}reqwest::Client{{/supportMiddleware}}, + pub client: {{#supportMiddleware}}reqwest_middleware::ClientWithMiddleware{{/supportMiddleware}}{{^supportMiddleware}}reqwest{{^supportAsync}}::blocking{{/supportAsync}}::Client{{/supportMiddleware}}, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -80,7 +80,7 @@ impl Default for Configuration { Configuration { base_path: "{{{basePath}}}".to_owned(), user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{{version}}}/rust".to_owned()){{/httpUserAgent}}, - client: {{#supportMiddleware}}reqwest_middleware::ClientBuilder::new(reqwest::Client::new()).build(){{/supportMiddleware}}{{^supportMiddleware}}reqwest::Client::new(){{/supportMiddleware}}, + client: {{#supportMiddleware}}reqwest_middleware::ClientBuilder::new(reqwest{{^supportAsync}}::blocking{{/supportAsync}}::Client::new()).build(){{/supportMiddleware}}{{^supportMiddleware}}reqwest{{^supportAsync}}::blocking{{/supportAsync}}::Client::new(){{/supportMiddleware}}, basic_auth: None, oauth_access_token: None, bearer_access_token: None, diff --git a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml index 7b07dbb5681..e7287efb32b 100644 --- a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml +++ b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml @@ -13,4 +13,6 @@ serde_with = "^2.0" serde_json = "^1.0" url = "^2.2" uuid = { version = "^1.0", features = ["serde", "v4"] } -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/others/rust/reqwest-regression-16119/src/apis/configuration.rs b/samples/client/others/rust/reqwest-regression-16119/src/apis/configuration.rs index 68a1939de2f..d1b488dc8b8 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/apis/configuration.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/apis/configuration.rs @@ -14,7 +14,7 @@ pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: reqwest::Client, + pub client: reqwest::blocking::Client, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -42,7 +42,7 @@ impl Default for Configuration { Configuration { base_path: "http://api.example.xyz/v1".to_owned(), user_agent: Some("OpenAPI-Generator/0.1.0/rust".to_owned()), - client: reqwest::Client::new(), + client: reqwest::blocking::Client::new(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, diff --git a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml index 5e7f18223f5..d7c5df28fbf 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml @@ -12,4 +12,6 @@ serde_derive = "^1.0" serde_json = "^1.0" url = "^2.2" uuid = { version = "^1.0", features = ["serde", "v4"] } -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/configuration.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/configuration.rs index 76cc4bf042b..c2176e57ad0 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/configuration.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/configuration.rs @@ -14,7 +14,7 @@ pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: reqwest::Client, + pub client: reqwest::blocking::Client, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -42,7 +42,7 @@ impl Default for Configuration { Configuration { base_path: "http://petstore.swagger.io/v2".to_owned(), user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()), - client: reqwest::Client::new(), + client: reqwest::blocking::Client::new(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml index 031c64aab0f..a390b57fa5b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml @@ -16,4 +16,6 @@ uuid = { version = "^1.0", features = ["serde", "v4"] } aws-sigv4 = "0.3.0" http = "0.2.5" secrecy = "0.8.0" -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs index 3e10cc7c358..e8b030ae01b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/configuration.rs @@ -18,7 +18,7 @@ use secrecy::{SecretString, ExposeSecret}; pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: reqwest::Client, + pub client: reqwest::blocking::Client, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -83,7 +83,7 @@ impl Default for Configuration { Configuration { base_path: "http://petstore.swagger.io/v2".to_owned(), user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()), - client: reqwest::Client::new(), + client: reqwest::blocking::Client::new(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, 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 bbfd13f1265..81edae5f241 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 @@ -444,7 +444,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let mut local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::blocking::multipart::Form::new(); if let Some(local_var_param_value) = additional_metadata { local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string()); } diff --git a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml index ae0098206eb..ac96d24a7db 100644 --- a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml @@ -13,4 +13,6 @@ serde_with = "^2.0" serde_json = "^1.0" url = "^2.2" uuid = { version = "^1.0", features = ["serde", "v4"] } -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/configuration.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/configuration.rs index ba335d974cc..8a43283dd43 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/configuration.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/configuration.rs @@ -14,7 +14,7 @@ pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: reqwest::Client, + pub client: reqwest::blocking::Client, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -42,7 +42,7 @@ impl Default for Configuration { Configuration { base_path: "http://petstore.swagger.io/v2".to_owned(), user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()), - client: reqwest::Client::new(), + client: reqwest::blocking::Client::new(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, 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 0e0a2bc19a1..4fb8e4c8af6 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 @@ -340,7 +340,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); }; - let mut local_var_form = reqwest::multipart::Form::new(); + let mut local_var_form = reqwest::blocking::multipart::Form::new(); if let Some(local_var_param_value) = additional_metadata { local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string()); }