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

editoast: bump axum from 0.7.9 to 0.8.1 in /editoast #10252

Merged
merged 1 commit into from
Jan 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
89 changes: 70 additions & 19 deletions editoast/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions editoast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ uuid = { version = "1.11.0", features = ["serde", "v4"] }
[dependencies]
anyhow = "1.0"
async-trait = "0.1.84"
axum = { version = "0.7.9", default-features = false, features = [
axum = { version = "0.8.1", default-features = false, features = [
"multipart",
"tracing",
] }
axum-extra = { version = "0.9.6", default-features = false, features = [
axum-extra = { version = "0.10.0", default-features = false, features = [
"typed-header",
] }
axum-test = { version = "16.4.1", default-features = false }
axum-tracing-opentelemetry = { version = "0.24.1", default-features = false, features = [
axum-test = { version = "17.0.1", default-features = false }
axum-tracing-opentelemetry = { version = "0.25.0", default-features = false, features = [
"tracing_level_info",
] }
chrono.workspace = true
Expand Down Expand Up @@ -172,7 +172,11 @@ regex = "1.11.1"
reqwest.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde_qs = { version = "0.13.0", features = ["axum"] }
# official serde_qs seems unmaintained. Bump to `axum:0.8` is an opened PR waiting to be merged.
# https://github.com/samscott89/serde_qs/pull/118
serde_qs = { version = "0.13.0", git = "https://github.com/Atrox/serde_qs", rev = "2cfa3ee0", features = [
"axum",
] }
serde_yaml = "0.9.34"
sha1 = "0.10"
strum.workspace = true
Expand All @@ -197,7 +201,7 @@ validator = { version = "0.19.0", features = ["derive"] }

[dev-dependencies]
async-std = { version = "1.13.0", features = ["attributes", "tokio1"] }
axum = { version = "0.7.9", default-features = false, features = [
axum = { version = "0.8.1", default-features = false, features = [
"macros",
"multipart",
"tracing",
Expand Down
20 changes: 1 addition & 19 deletions editoast/src/views/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,6 @@ where
}
}

/// Reformats a service path defined in the OpenApi format to the Axum format
///
/// For path parameters, the OpenApi format uses curly braces, e.g. `/users/{id}`.
/// The Axum format uses a colon, e.g. `/users/:id`.
/// The `routes!` macro requires path parameters to be defined in the OpenApi format.
pub(in crate::views) fn format_axum_path_parameters(url_with_path_params: &str) -> String {
url_with_path_params
.split('/')
.map(|part| {
if part.starts_with('{') && part.ends_with('}') {
format!(":{}", &part[1..part.len() - 1])
} else {
part.to_string()
}
})
.join("/")
}

#[allow(unused)]
impl OpenApiPathScope {
pub fn new(prefix: Option<&'static str>) -> Self {
Expand Down Expand Up @@ -227,7 +209,7 @@ macro_rules! routes {
(@router [$router:expr] $prefix:literal => {$($tt:tt)+} , $($rest:tt)*) => {
$crate::routes!(@router
[$router.nest(
&$crate::views::openapi::format_axum_path_parameters($prefix),
&$prefix,
$crate::routes!(@router [axum::Router::<$crate::AppState>::new()] $($tt)+)
)]
$($rest)*
Expand Down
Loading