From cf5d17bbfeab881a54b46383375651fd596b4ea4 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Wed, 18 Sep 2024 08:22:51 +0100 Subject: [PATCH] [Rust Server] Convert Rust comment to Mustache (#19595) * [Rust Server] Convert Rust comment to Mustache The comment about auth types supported by the generator shouldn't be included in the generated code as it's confusing when the API doesn't support the same auth types. As such, we convert it from a Rust comment to a Mustache comment * Update samples --- .../resources/rust-server/client-operation.mustache | 2 +- .../rust-server/output/openapi-v3/src/client/mod.rs | 2 -- .../src/client/mod.rs | 11 ----------- .../output/ping-bearer-auth/src/client/mod.rs | 1 - 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache index fec80b345b8..a5f96e3dbfa 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache @@ -95,7 +95,7 @@ {{#hasAuthMethods}} #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported + {{! Currently only authentication with Basic and Bearer are supported }} #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { {{#authMethods}} diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index 5087537615d..4fb9ca39693 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -1191,7 +1191,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -1519,7 +1518,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 96e66db706f..0d20a12196a 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -1272,7 +1272,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Basic(basic_header) => { @@ -1759,7 +1758,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { _ => {} @@ -1859,7 +1857,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -1949,7 +1946,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2057,7 +2053,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2174,7 +2169,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2274,7 +2268,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2381,7 +2374,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { _ => {} @@ -2500,7 +2492,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2648,7 +2639,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => { @@ -2746,7 +2736,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { _ => {} diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/client/mod.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/client/mod.rs index 22eb1b5814c..9e6dfec94b3 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/client/mod.rs @@ -421,7 +421,6 @@ impl Api for Client where #[allow(clippy::collapsible_match)] if let Some(auth_data) = Has::>::get(context).as_ref() { - // Currently only authentication with Basic and Bearer are supported #[allow(clippy::single_match, clippy::match_single_binding)] match auth_data { AuthData::Bearer(bearer_header) => {