Skip to content

Commit b54b2eb

Browse files
committed
Bump axum and axum-extra to latest version.
- This bump requires fixing path parameters due to matchit transitive dependency changes (See tokio-rs/axum#2645). - The `Host` extractor has been moved from `axum` to `axum-extra`. - Axum now ships multipart extractor support, switch to that.
1 parent aeb7caf commit b54b2eb

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
427427
for (CodegenParameter param : op.pathParams) {
428428
// Replace {baseName} with {paramName} for format string
429429
String paramSearch = "{" + param.baseName + "}";
430-
String paramReplace = ":" + param.paramName;
430+
String paramReplace = "{" + param.paramName + "}";
431431

432432
axumPath = axumPath.replace(paramSearch, paramReplace);
433433
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ conversion = [
4040

4141
[dependencies]
4242
async-trait = "0.1"
43-
axum = "0.7"
44-
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
43+
axum = { version = "0.8", features = ["multipart"] }
44+
axum-extra = { version = "0.10", features = ["cookie"] }
4545
base64 = "0.22"
4646
bytes = "1"
4747
chrono = { version = "0.4", features = ["serde"] }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
3737
async fn handle_error(
3838
&self,
3939
method: &::http::Method,
40-
host: &axum::extract::Host,
40+
host: &axum_extra::extract::Host,
4141
cookies: &axum_extra::extract::CookieJar,
4242
error: E
4343
) -> Result<axum::response::Response, http::StatusCode> {
@@ -47,4 +47,4 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
4747
.body(axum::body::Body::empty())
4848
.map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)
4949
}
50-
}
50+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_trait::async_trait;
22
use axum::extract::*;
3-
use axum_extra::extract::{CookieJar, Multipart};
3+
use axum_extra::extract::{CookieJar, Host};
44
use bytes::Bytes;
55
use http::Method;
66
use serde::{Deserialize, Serialize};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashMap;
22

33
use axum::{body::Body, extract::*, response::Response, routing::*};
4-
use axum_extra::extract::{CookieJar, Multipart};
4+
use axum_extra::extract::{CookieJar, Host};
55
use bytes::Bytes;
66
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
77
use tracing::error;

0 commit comments

Comments
 (0)