From e3b694f3dff98186cb0ecd3faca035d90b9ef0e6 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 26 Nov 2025 15:33:32 +0000 Subject: [PATCH] Ensure rust-server compiles with no-default-features --- .github/workflows/samples-rust-server.yaml | 5 ++++- .../codegen/languages/RustServerCodegen.java | 9 +++++++++ .../languages/RustServerCodegenDeprecated.java | 9 +++++++++ .../rust-server-deprecated/Cargo.mustache | 12 +++++++++--- .../rust-server-deprecated/auth.mustache | 5 ++--- .../resources/rust-server-deprecated/lib.mustache | 4 +--- .../src/main/resources/rust-server/Cargo.mustache | 15 ++++++++++++--- .../src/main/resources/rust-server/auth.mustache | 3 +-- .../src/main/resources/rust-server/lib.mustache | 5 ++--- .../output/multipart-v3/Cargo.toml | 6 +++--- .../output/multipart-v3/src/auth.rs | 5 ++--- .../output/multipart-v3/src/lib.rs | 4 +--- .../output/no-example-v3/Cargo.toml | 4 ++-- .../output/no-example-v3/src/auth.rs | 5 ++--- .../output/no-example-v3/src/lib.rs | 4 +--- .../output/openapi-v3/Cargo.toml | 8 ++++---- .../output/openapi-v3/src/auth.rs | 5 ++--- .../output/openapi-v3/src/lib.rs | 4 +--- .../output/ops-v3/Cargo.toml | 4 ++-- .../output/ops-v3/src/auth.rs | 5 ++--- .../output/ops-v3/src/lib.rs | 4 +--- .../Cargo.toml | 6 +++--- .../src/auth.rs | 5 ++--- .../src/lib.rs | 4 +--- .../output/ping-bearer-auth/Cargo.toml | 4 ++-- .../output/ping-bearer-auth/src/auth.rs | 5 ++--- .../output/ping-bearer-auth/src/lib.rs | 4 +--- .../output/rust-server-test/Cargo.toml | 4 ++-- .../output/rust-server-test/src/auth.rs | 5 ++--- .../output/rust-server-test/src/lib.rs | 4 +--- .../rust-server/output/multipart-v3/Cargo.toml | 9 ++++++--- .../rust-server/output/multipart-v3/src/auth.rs | 3 +-- .../rust-server/output/multipart-v3/src/lib.rs | 5 ++--- .../rust-server/output/no-example-v3/Cargo.toml | 7 +++++-- .../rust-server/output/no-example-v3/src/auth.rs | 3 +-- .../rust-server/output/no-example-v3/src/lib.rs | 5 ++--- .../rust-server/output/openapi-v3/Cargo.toml | 11 +++++++---- .../rust-server/output/openapi-v3/src/auth.rs | 3 +-- .../rust-server/output/openapi-v3/src/lib.rs | 5 ++--- .../petstore/rust-server/output/ops-v3/Cargo.toml | 7 +++++-- .../rust-server/output/ops-v3/src/auth.rs | 3 +-- .../petstore/rust-server/output/ops-v3/src/lib.rs | 5 ++--- .../Cargo.toml | 9 ++++++--- .../src/auth.rs | 3 +-- .../src/lib.rs | 5 ++--- .../output/ping-bearer-auth/Cargo.toml | 7 +++++-- .../output/ping-bearer-auth/src/auth.rs | 3 +-- .../output/ping-bearer-auth/src/lib.rs | 5 ++--- .../output/rust-server-test/Cargo.toml | 7 +++++-- .../output/rust-server-test/src/auth.rs | 3 +-- .../output/rust-server-test/src/lib.rs | 5 ++--- 51 files changed, 148 insertions(+), 131 deletions(-) diff --git a/.github/workflows/samples-rust-server.yaml b/.github/workflows/samples-rust-server.yaml index 025b24bb8783..cecbef24a7fe 100644 --- a/.github/workflows/samples-rust-server.yaml +++ b/.github/workflows/samples-rust-server.yaml @@ -39,7 +39,10 @@ jobs: - name: Build working-directory: ${{ matrix.sample }} - run: cargo build --all-targets --all-features + run: | + set -e + cargo build --all-targets --all-features + cargo build --all-targets --no-default-features - name: Tests working-directory: ${{ matrix.sample }} run: | diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index bab781d13302..e512515a0978 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -1233,6 +1233,10 @@ public CodegenModel fromModel(String name, Schema model) { additionalProperties.put("apiUsesUuid", true); } + if (prop.isByteArray) { + additionalProperties.put("apiUsesByteArray", true); + } + String xmlName = modelXmlNames.get(prop.dataType); if (xmlName != null) { prop.vendorExtensions.put("x-item-xml-name", xmlName); @@ -1535,6 +1539,11 @@ private void processParam(CodegenParameter param, CodegenOperation op) { additionalProperties.put("apiUsesUuid", true); } + // If a parameter uses byte arrays, we need to set a flag. + if (param.isByteArray) { + additionalProperties.put("apiUsesByteArray", true); + } + if (Boolean.TRUE.equals(param.isFreeFormObject)) { param.vendorExtensions.put("x-format-string", "{:?}"); example = null; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegenDeprecated.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegenDeprecated.java index 49f95f285245..e21d509791f1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegenDeprecated.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegenDeprecated.java @@ -1213,6 +1213,10 @@ public CodegenModel fromModel(String name, Schema model) { additionalProperties.put("apiUsesUuid", true); } + if (prop.isByteArray) { + additionalProperties.put("apiUsesByteArray", true); + } + String xmlName = modelXmlNames.get(prop.dataType); if (xmlName != null) { prop.vendorExtensions.put("x-item-xml-name", xmlName); @@ -1515,6 +1519,11 @@ private void processParam(CodegenParameter param, CodegenOperation op) { additionalProperties.put("apiUsesUuid", true); } + // If a parameter uses byte arrays, we need to set a flag. + if (param.isByteArray) { + additionalProperties.put("apiUsesByteArray", true); + } + if (Boolean.TRUE.equals(param.isFreeFormObject)) { param.vendorExtensions.put("x-format-string", "{:?}"); example = null; diff --git a/modules/openapi-generator/src/main/resources/rust-server-deprecated/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server-deprecated/Cargo.mustache index da9c6a599b77..7ea81f12a669 100644 --- a/modules/openapi-generator/src/main/resources/rust-server-deprecated/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server-deprecated/Cargo.mustache @@ -47,7 +47,7 @@ client = [ "serde_urlencoded", {{/usesUrlEncodedForm}} {{#hasCallbacks}} - "serde_ignored", "regex", "percent-encoding", "lazy_static", + "serde_ignored", "percent-encoding", {{^apiUsesByteArray}}"lazy_static", "regex",{{/apiUsesByteArray}} {{/hasCallbacks}} {{! Anything added to the list below, should probably be added to the callbacks list below }} "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" @@ -66,7 +66,7 @@ server = [ "native-tls", "hyper-openssl", "hyper-tls", "openssl", {{/hasCallbacks}} {{! Anything added to the list below, should probably be added to the callbacks list above }} - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" {{^apiUsesByteArray}},"lazy_static", "regex"{{/apiUsesByteArray}} ] cli = [ {{#apiHasDeleteMethods}} @@ -96,6 +96,10 @@ mime = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.16", features = ["derive"] } +{{#apiUsesByteArray}} +lazy_static = "1.5" +regex = "1.12" +{{/apiUsesByteArray}} # Crates included if required by the API definition {{#usesXml}} @@ -126,9 +130,11 @@ serde_urlencoded = {version = "0.6.1", optional = true} {{/usesUrlEncodedForm}} # Server, and client callback-specific +{{^apiUsesByteArray}} lazy_static = { version = "1.4", optional = true } -percent-encoding = {version = "2.1.0", optional = true} regex = {version = "1.3", optional = true} +{{/apiUsesByteArray}} +percent-encoding = {version = "2.1.0", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/modules/openapi-generator/src/main/resources/rust-server-deprecated/auth.mustache b/modules/openapi-generator/src/main/resources/rust-server-deprecated/auth.mustache index d2b1481eeb81..ff8674f6c677 100644 --- a/modules/openapi-generator/src/main/resources/rust-server-deprecated/auth.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server-deprecated/auth.mustache @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/modules/openapi-generator/src/main/resources/rust-server-deprecated/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server-deprecated/lib.mustache index e6d2bf190130..cbd1f8ff94ae 100644 --- a/modules/openapi-generator/src/main/resources/rust-server-deprecated/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server-deprecated/lib.mustache @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache index 499a8d4f097f..5cee315fe481 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache @@ -44,7 +44,7 @@ client = [ "serde_urlencoded", {{/usesUrlEncodedForm}} {{#hasCallbacks}} - "serde_ignored", "regex", "percent-encoding", "lazy_static", + "serde_ignored", "percent-encoding", {{^apiUsesByteArray}}"lazy_static", "regex"{{/apiUsesByteArray}} {{/hasCallbacks}} {{! Anything added to the list below, should probably be added to the callbacks list below }} "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" @@ -60,7 +60,8 @@ server = [ "native-tls", "hyper-openssl", "hyper-tls", "openssl", {{/hasCallbacks}} {{! Anything added to the list below, should probably be added to the callbacks list above }} - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + {{^apiUsesByteArray}}"lazy_static", "regex"{{/apiUsesByteArray}} ] cli = [ {{#apiHasDeleteMethods}} @@ -88,8 +89,14 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } +{{#apiUsesByteArray}} +lazy_static = "1.5" +regex = "1.12" +{{/apiUsesByteArray}} + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -124,9 +131,11 @@ serde_urlencoded = { version = "0.7.1", optional = true } tower-service = "0.3.3" # Server, and client callback-specific +{{^apiUsesByteArray}} lazy_static = { version = "1.5", optional = true } -percent-encoding = { version = "2.3.1", optional = true } regex = { version = "1.12", optional = true } +{{/apiUsesByteArray}} +percent-encoding = { version = "2.3.1", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/modules/openapi-generator/src/main/resources/rust-server/auth.mustache b/modules/openapi-generator/src/main/resources/rust-server/auth.mustache index f363db66d495..a6a39f79450f 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/auth.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/auth.mustache @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache index 1c5f9ca7e2ee..fe7e425608ce 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = "{{{basePathWithoutHost}}}"; diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/Cargo.toml index c17bc7e481fd..94409b6cbcd0 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/Cargo.toml @@ -19,7 +19,7 @@ server = [ "mime_0_2", "multipart", "multipart/server", "swagger/multipart_form", "hyper_0_10", "mime_multipart", "swagger/multipart_related", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -46,6 +46,8 @@ mime = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.16", features = ["derive"] } +lazy_static = "1.5" +regex = "1.12" # Crates included if required by the API definition mime_0_2 = { package = "mime", version = "0.2.6", optional = true } @@ -61,9 +63,7 @@ url = {version = "2.1", optional = true} # Client-specific # Server, and client callback-specific -lazy_static = { version = "1.4", optional = true } percent-encoding = {version = "2.1.0", optional = true} -regex = {version = "1.3", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs index e8deab51d1f9..8ce4c0f47af7 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/Cargo.toml index 4315116e7edf..97b38209d897 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/Cargo.toml @@ -13,7 +13,7 @@ client = [ "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ,"lazy_static", "regex" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -52,8 +52,8 @@ url = {version = "2.1", optional = true} # Server, and client callback-specific lazy_static = { version = "1.4", optional = true } -percent-encoding = {version = "2.1.0", optional = true} regex = {version = "1.3", optional = true} +percent-encoding = {version = "2.1.0", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs index 446a8223f29b..415699b71c5c 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/Cargo.toml index c4cec054c7c7..d74e1bc72df9 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/Cargo.toml @@ -11,12 +11,12 @@ edition = "2018" default = ["client", "server"] client = [ "serde_urlencoded", - "serde_ignored", "regex", "percent-encoding", "lazy_static", + "serde_ignored", "percent-encoding", "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ "native-tls", "hyper-openssl", "hyper-tls", "openssl", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -43,6 +43,8 @@ mime = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.16", features = ["derive"] } +lazy_static = "1.5" +regex = "1.12" # Crates included if required by the API definition serde-xml-rs = "0.8" @@ -57,9 +59,7 @@ url = {version = "2.1", optional = true} serde_urlencoded = {version = "0.6.1", optional = true} # Server, and client callback-specific -lazy_static = { version = "1.4", optional = true } percent-encoding = {version = "2.1.0", optional = true} -regex = {version = "1.3", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs index 72c7e7adc4b9..65e5f47282dc 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/ops-v3/Cargo.toml index 0c33be7b5ea2..3f9de165eabe 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/Cargo.toml @@ -13,7 +13,7 @@ client = [ "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ,"lazy_static", "regex" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -52,8 +52,8 @@ url = {version = "2.1", optional = true} # Server, and client callback-specific lazy_static = { version = "1.4", optional = true } -percent-encoding = {version = "2.1.0", optional = true} regex = {version = "1.3", optional = true} +percent-encoding = {version = "2.1.0", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs index 1146e3a542bc..d874712a75e2 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index 4adf1eb310d2..444dd4b96557 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -18,7 +18,7 @@ client = [ server = [ "mime_0_2", "multipart", "multipart/server", "swagger/multipart_form", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ] cli = [ "dialoguer", @@ -46,6 +46,8 @@ mime = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.16", features = ["derive"] } +lazy_static = "1.5" +regex = "1.12" # Crates included if required by the API definition serde-xml-rs = "0.8" @@ -62,9 +64,7 @@ url = {version = "2.1", optional = true} serde_urlencoded = {version = "0.6.1", optional = true} # Server, and client callback-specific -lazy_static = { version = "1.4", optional = true } percent-encoding = {version = "2.1.0", optional = true} -regex = {version = "1.3", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index eceda44ef619..4791f388b517 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/Cargo.toml index c8e60c539bba..e56f964f0bc3 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/Cargo.toml @@ -13,7 +13,7 @@ client = [ "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ,"lazy_static", "regex" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -52,8 +52,8 @@ url = {version = "2.1", optional = true} # Server, and client callback-specific lazy_static = { version = "1.4", optional = true } -percent-encoding = {version = "2.1.0", optional = true} regex = {version = "1.3", optional = true} +percent-encoding = {version = "2.1.0", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs index 6a5aca7d1949..e5442d6353f6 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/Cargo.toml b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/Cargo.toml index f85aaea14517..997423d90583 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/Cargo.toml +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/Cargo.toml @@ -13,7 +13,7 @@ client = [ "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url" ,"lazy_static", "regex" ] cli = [ "anyhow", "clap-verbosity-flag", "simple_logger", "structopt", "tokio" @@ -52,8 +52,8 @@ url = {version = "2.1", optional = true} # Server, and client callback-specific lazy_static = { version = "1.4", optional = true } -percent-encoding = {version = "2.1.0", optional = true} regex = {version = "1.3", optional = true} +percent-encoding = {version = "2.1.0", optional = true} # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/auth.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/auth.rs index d2b1481eeb81..ff8674f6c677 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/auth.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::{ApiError, auth::{Basic, Bearer}}; +use swagger::{ApiError, auth::{Basic, Bearer, Authorization}}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { @@ -24,7 +23,7 @@ pub trait AuthenticationApi { /// Method should be implemented (see example-code) to map Basic (Username:password) to an Authorization fn basic_authorization(&self, basic: &Basic) -> Result; -} +} // Implement it for AllowAllAuthenticator (dummy is needed, but should not used as we have Bearer authorization) use swagger::auth::{AllowAllAuthenticator, RcBound, Scopes}; diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs index 4d1dc3f567ba..6740ec34935e 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs @@ -6,10 +6,8 @@ use futures::Stream; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - type ServiceError = Box; diff --git a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml index 5cfe58871451..576f6445f35a 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml @@ -17,7 +17,8 @@ client = [ server = [ "multipart", "multipart/server", "swagger/multipart_form", "mime_multipart", "swagger/multipart_related", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -42,8 +43,12 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } +lazy_static = "1.5" +regex = "1.12" + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -65,9 +70,7 @@ url = { version = "2.5", optional = true } tower-service = "0.3.3" # Server, and client callback-specific -lazy_static = { version = "1.5", optional = true } percent-encoding = { version = "2.3.1", optional = true } -regex = { version = "1.12", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs index eec859f8a4bc..43c3b8fb6e35 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = ""; diff --git a/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml index e6f1d29c15d9..e3abfa405b29 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml @@ -13,7 +13,8 @@ client = [ "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + "lazy_static", "regex" ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -38,9 +39,11 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.20", features = ["derive"] } @@ -60,8 +63,8 @@ tower-service = "0.3.3" # Server, and client callback-specific lazy_static = { version = "1.5", optional = true } -percent-encoding = { version = "2.3.1", optional = true } regex = { version = "1.12", optional = true } +percent-encoding = { version = "2.3.1", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs index 92053dfbca3c..dd3536e86305 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = ""; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml index a28c493b609e..b733fa1cfa04 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml @@ -11,12 +11,13 @@ edition = "2018" default = ["client", "server"] client = [ "serde_urlencoded", - "serde_ignored", "regex", "percent-encoding", "lazy_static", + "serde_ignored", "percent-encoding", "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ "native-tls", "hyper-openssl", "hyper-tls", "openssl", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -41,8 +42,12 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } +lazy_static = "1.5" +regex = "1.12" + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -65,9 +70,7 @@ serde_urlencoded = { version = "0.7.1", optional = true } tower-service = "0.3.3" # Server, and client callback-specific -lazy_static = { version = "1.5", optional = true } percent-encoding = { version = "2.3.1", optional = true } -regex = { version = "1.12", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 95b7cfda262b..cf15134bdda5 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = ""; diff --git a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml index bd1503bb3e23..bcf14f93a002 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml @@ -13,7 +13,8 @@ client = [ "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + "lazy_static", "regex" ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -38,9 +39,11 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.20", features = ["derive"] } @@ -60,8 +63,8 @@ tower-service = "0.3.3" # Server, and client callback-specific lazy_static = { version = "1.5", optional = true } -percent-encoding = { version = "2.3.1", optional = true } regex = { version = "1.12", optional = true } +percent-encoding = { version = "2.3.1", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs b/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs index 7067fb30d709..35752b9d32fd 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = ""; diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index e344a84fed10..95248401db54 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -16,7 +16,8 @@ client = [ ] server = [ "multipart", "multipart/server", "swagger/multipart_form", - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + ] cli = [ "dialoguer", @@ -42,8 +43,12 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } +lazy_static = "1.5" +regex = "1.12" + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -67,9 +72,7 @@ serde_urlencoded = { version = "0.7.1", optional = true } tower-service = "0.3.3" # Server, and client callback-specific -lazy_static = { version = "1.5", optional = true } percent-encoding = { version = "2.3.1", optional = true } -regex = { version = "1.12", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 6b31a7ff8152..aa34695336e7 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = "/v2"; diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml b/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml index 2c998d32ee8c..bba286217044 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/Cargo.toml @@ -13,7 +13,8 @@ client = [ "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + "lazy_static", "regex" ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -38,9 +39,11 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.20", features = ["derive"] } @@ -60,8 +63,8 @@ tower-service = "0.3.3" # Server, and client callback-specific lazy_static = { version = "1.5", optional = true } -percent-encoding = { version = "2.3.1", optional = true } regex = { version = "1.12", optional = true } +percent-encoding = { version = "2.3.1", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs index 6d76af54f707..0c42b196f262 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = ""; diff --git a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml index 0c6e5f23258b..190e642083be 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml +++ b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml @@ -13,7 +13,8 @@ client = [ "hyper", "hyper-util/http1", "hyper-util/http2", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] server = [ - "serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static" + "serde_ignored", "hyper", "percent-encoding", "url", + "lazy_static", "regex" ] cli = [ "anyhow", "clap", "clap-verbosity-flag", "simple_logger", "tokio" @@ -38,9 +39,11 @@ futures = "0.3" swagger = { version = "7.0.0", features = ["serdejson", "server", "client", "tls"] } headers = "0.4.0" log = "0.4.27" + mime = "0.3" mockall = { version = "0.13.1", optional = true } + serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" validator = { version = "0.20", features = ["derive"] } @@ -60,8 +63,8 @@ tower-service = "0.3.3" # Server, and client callback-specific lazy_static = { version = "1.5", optional = true } -percent-encoding = { version = "2.3.1", optional = true } regex = { version = "1.12", optional = true } +percent-encoding = { version = "2.3.1", optional = true } # CLI-specific anyhow = { version = "1", optional = true } diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs index f363db66d495..a6a39f79450f 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs @@ -1,7 +1,6 @@ use std::collections::BTreeSet; -use crate::server::Authorization; use serde::{Deserialize, Serialize}; -use swagger::ApiError; +use swagger::{ApiError, auth::Authorization}; use headers::authorization::{Basic, Bearer}; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index 170f15a06c60..5b9072a59bd1 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -8,11 +8,10 @@ use mockall::automock; use std::error::Error; use std::collections::BTreeSet; use std::task::{Poll, Context}; -use swagger::{ApiError, ContextWrapper}; +use swagger::{ApiError, ContextWrapper, auth::Authorization}; use serde::{Serialize, Deserialize}; -use crate::server::Authorization; - +#[cfg(any(feature = "client", feature = "server"))] type ServiceError = Box; pub const BASE_PATH: &str = "";