Skip to content

Commit aa930e6

Browse files
authored
[Rust-Axum] Fix generating error upon special model name (#23994)
* [Rust-Axum] Fix generating error upon special model name * Update
1 parent acd0bdd commit aa930e6

32 files changed

Lines changed: 177 additions & 5 deletions

File tree

modules/openapi-generator/src/main/resources/rust-axum/lib.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
clippy::too_many_arguments
1515
)]
1616

17+
extern crate futures_util;
18+
1719
pub const BASE_PATH: &str = "{{{basePathWithoutHost}}}";
1820
{{#appVersion}}
1921
pub const API_VERSION: &str = "{{{.}}}";

modules/openapi-generator/src/main/resources/rust-axum/models.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::header;
88
use crate::{models, types::*};
99

1010
#[allow(dead_code)]
11-
pub type SSE = std::pin::Pin<Box<dyn futures_util::Stream<Item = Result<axum::response::sse::Event, std::convert::Infallible>> + Send + Sync>>;
11+
pub type SSE = std::pin::Pin<std::boxed::Box<dyn futures_util::Stream<Item = std::result::Result<axum::response::sse::Event, std::convert::Infallible>> + std::marker::Send + std::marker::Sync>>;
1212

1313
#[allow(dead_code)]
1414
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {

samples/server/petstore/rust-axum/output/apikey-authorization/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
clippy::too_many_arguments
1515
)]
1616

17+
extern crate futures_util;
18+
1719
pub const BASE_PATH: &str = "/v71";
1820
pub const API_VERSION: &str = "1.0.0";
1921

samples/server/petstore/rust-axum/output/apikey-authorization/src/models.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ use validator::Validate;
77
use crate::header;
88
use crate::{models, types::*};
99

10+
#[allow(dead_code)]
11+
pub type SSE = std::pin::Pin<
12+
std::boxed::Box<
13+
dyn futures_util::Stream<
14+
Item = std::result::Result<axum::response::sse::Event, std::convert::Infallible>,
15+
> + std::marker::Send
16+
+ std::marker::Sync,
17+
>,
18+
>;
19+
1020
#[allow(dead_code)]
1121
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {
1222
let mut errs = validator::ValidationErrors::new();

samples/server/petstore/rust-axum/output/apikey-auths/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
clippy::too_many_arguments
1515
)]
1616

17+
extern crate futures_util;
18+
1719
pub const BASE_PATH: &str = "/v71";
1820
pub const API_VERSION: &str = "1.0.0";
1921

samples/server/petstore/rust-axum/output/apikey-auths/src/models.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ use validator::Validate;
77
use crate::header;
88
use crate::{models, types::*};
99

10+
#[allow(dead_code)]
11+
pub type SSE = std::pin::Pin<
12+
std::boxed::Box<
13+
dyn futures_util::Stream<
14+
Item = std::result::Result<axum::response::sse::Event, std::convert::Infallible>,
15+
> + std::marker::Send
16+
+ std::marker::Sync,
17+
>,
18+
>;
19+
1020
#[allow(dead_code)]
1121
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {
1222
let mut errs = validator::ValidationErrors::new();

samples/server/petstore/rust-axum/output/multipart-v3/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
clippy::too_many_arguments
1515
)]
1616

17+
extern crate futures_util;
18+
1719
pub const BASE_PATH: &str = "";
1820
pub const API_VERSION: &str = "1.0.7";
1921

samples/server/petstore/rust-axum/output/multipart-v3/src/models.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ use validator::Validate;
77
use crate::header;
88
use crate::{models, types::*};
99

10+
#[allow(dead_code)]
11+
pub type SSE = std::pin::Pin<
12+
std::boxed::Box<
13+
dyn futures_util::Stream<
14+
Item = std::result::Result<axum::response::sse::Event, std::convert::Infallible>,
15+
> + std::marker::Send
16+
+ std::marker::Sync,
17+
>,
18+
>;
19+
1020
#[allow(dead_code)]
1121
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {
1222
let mut errs = validator::ValidationErrors::new();

samples/server/petstore/rust-axum/output/openapi-v3/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
clippy::too_many_arguments
1515
)]
1616

17+
extern crate futures_util;
18+
1719
pub const BASE_PATH: &str = "";
1820
pub const API_VERSION: &str = "1.0.7";
1921

samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ use validator::Validate;
77
use crate::header;
88
use crate::{models, types::*};
99

10+
#[allow(dead_code)]
11+
pub type SSE = std::pin::Pin<
12+
std::boxed::Box<
13+
dyn futures_util::Stream<
14+
Item = std::result::Result<axum::response::sse::Event, std::convert::Infallible>,
15+
> + std::marker::Send
16+
+ std::marker::Sync,
17+
>,
18+
>;
19+
1020
#[allow(dead_code)]
1121
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {
1222
let mut errs = validator::ValidationErrors::new();

0 commit comments

Comments
 (0)