Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] Bump axum and axum-extra #20548

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
for (CodegenParameter param : op.pathParams) {
// Replace {baseName} with {paramName} for format string
String paramSearch = "{" + param.baseName + "}";
String paramReplace = ":" + param.paramName;
String paramReplace = "{" + param.paramName + "}";

axumPath = axumPath.replace(paramSearch, paramReplace);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E
) -> Result<axum::response::Response, http::StatusCode> {
Expand All @@ -47,4 +47,4 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
.body(axum::body::Body::empty())
.map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down Expand Up @@ -32,7 +32,7 @@ where
get(get_payment_methods::<I, A, E, C>),
)
.route(
"/v71/paymentMethods/:id",
"/v71/paymentMethods/{id}",
get(get_payment_method_by_id::<I, A, E, C>),
)
.route("/v71/payments", post(post_make_payment::<I, A, E, C>))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down Expand Up @@ -35,7 +35,7 @@ where
.route("/complex-query-param",
get(complex_query_param_get::<I, A, E>)
)
.route("/enum_in_path/:path_param",
.route("/enum_in_path/{path_param}",
get(enum_in_path_path_param_get::<I, A, E>)
)
.route("/form-test",
Expand All @@ -56,7 +56,7 @@ where
.route("/multiget",
get(multiget_get::<I, A, E>)
)
.route("/multiple-path-params-with-very-long-path-to-test-formatting/:path_param_a/:path_param_b",
.route("/multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b}",
get(multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get::<I, A, E>)
)
.route("/multiple_auth_scheme",
Expand All @@ -83,7 +83,7 @@ where
.route("/repos",
post(create_repo::<I, A, E>)
)
.route("/repos/:repo_id",
.route("/repos/{repo_id}",
get(get_repo_info::<I, A, E>).get(get_repo_info::<I, A, E>)
)
.route("/required_octet_stream",
Expand Down
4 changes: 2 additions & 2 deletions samples/server/petstore/rust-axum/output/ops-v3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ conversion = [

[dependencies]
async-trait = "0.1"
axum = "0.7"
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
async fn handle_error(
&self,
method: &::http::Method,
host: &axum::extract::Host,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use axum::extract::*;
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::Method;
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use axum::{body::Body, extract::*, response::Response, routing::*};
use axum_extra::extract::{CookieJar, Multipart};
use axum_extra::extract::{CookieJar, Host};
use bytes::Bytes;
use http::{header::CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use tracing::error;
Expand Down Expand Up @@ -46,7 +46,7 @@ where
put(test_body_with_query_params::<I, A, E>),
)
.route(
"/v2/fake/hyphenParam/:hyphen_param",
"/v2/fake/hyphenParam/{hyphen_param}",
get(hyphen_param::<I, A, E>),
)
.route(
Expand Down Expand Up @@ -84,33 +84,27 @@ where
post(add_pet::<I, A, E, C>).put(update_pet::<I, A, E, C>),
)
.route(
"/v2/pet/:pet_id",
"/v2/pet/findByStatus",
get(find_pets_by_status::<I, A, E, C>),
)
.route("/v2/pet/findByTags", get(find_pets_by_tags::<I, A, E, C>))
.route(
"/v2/pet/{pet_id}",
delete(delete_pet::<I, A, E, C>)
.get(get_pet_by_id::<I, A, E, C>)
.post(update_pet_with_form::<I, A, E, C>),
)
.route(
"/v2/pet/:pet_id/uploadImage",
"/v2/pet/{pet_id}/uploadImage",
post(upload_file::<I, A, E, C>),
)
.route(
"/v2/pet/findByStatus",
get(find_pets_by_status::<I, A, E, C>),
)
.route("/v2/pet/findByTags", get(find_pets_by_tags::<I, A, E, C>))
.route("/v2/store/inventory", get(get_inventory::<I, A, E, C>))
.route("/v2/store/order", post(place_order::<I, A, E, C>))
.route(
"/v2/store/order/:order_id",
"/v2/store/order/{order_id}",
delete(delete_order::<I, A, E, C>).get(get_order_by_id::<I, A, E, C>),
)
.route("/v2/user", post(create_user::<I, A, E>))
.route(
"/v2/user/:username",
delete(delete_user::<I, A, E>)
.get(get_user_by_name::<I, A, E>)
.put(update_user::<I, A, E>),
)
.route(
"/v2/user/createWithArray",
post(create_users_with_array_input::<I, A, E>),
Expand All @@ -121,6 +115,12 @@ where
)
.route("/v2/user/login", get(login_user::<I, A, E>))
.route("/v2/user/logout", get(logout_user::<I, A, E>))
.route(
"/v2/user/{username}",
delete(delete_user::<I, A, E>)
.get(get_user_by_name::<I, A, E>)
.put(update_user::<I, A, E>),
)
.with_state(api_impl)
}

Expand Down
Loading
Loading