From dd168ea363d6e8c983636fb4abea2662e09af3c5 Mon Sep 17 00:00:00 2001 From: Daniel Schneider Date: Sun, 6 Jul 2025 14:56:51 +0200 Subject: [PATCH 1/2] chore: bump schemars to 1.0.4 --- crates/aide/Cargo.toml | 2 +- examples/example-axum-worker/Cargo.toml | 2 +- examples/example-axum/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/aide/Cargo.toml b/crates/aide/Cargo.toml index bce28043..140b01cc 100644 --- a/crates/aide/Cargo.toml +++ b/crates/aide/Cargo.toml @@ -11,7 +11,7 @@ readme = "README.md" [dependencies] indexmap = { version = "2.1", features = ["serde"] } -schemars = { version = "0.9.0", features = ["indexmap2"] } +schemars = { version = "1.0.4", features = ["indexmap2"] } serde = { version = "1.0.144", features = ["derive"] } serde_json = "1" thiserror = "2.0" diff --git a/examples/example-axum-worker/Cargo.toml b/examples/example-axum-worker/Cargo.toml index 6c8579e5..560e982c 100644 --- a/examples/example-axum-worker/Cargo.toml +++ b/examples/example-axum-worker/Cargo.toml @@ -19,7 +19,7 @@ tower-service = "0.3.2" worker = { version = "0.5.0", features = ["http", "axum"] } console_error_panic_hook = "0.1.7" axum = { version = "0.8.1", default-features = false, features = ["macros", "form", "matched-path", "query", "original-uri"] } -schemars = { version = "0.9.0", features = ["uuid1"] } +schemars = { version = "1.0.4", features = ["uuid1"] } serde = { version = "1.0.144", features = ["derive", "rc"] } serde_json = "1.0.85" uuid = { version = "1.1.2", features = ["serde", "v4"] } diff --git a/examples/example-axum/Cargo.toml b/examples/example-axum/Cargo.toml index ceaff556..e121e93b 100644 --- a/examples/example-axum/Cargo.toml +++ b/examples/example-axum/Cargo.toml @@ -13,7 +13,7 @@ aide = { path = "../../crates/aide", features = [ "macros", ] } axum = { version = "0.8.1", features = ["macros"] } -schemars = { version = "0.9.0", features = ["uuid1"] } +schemars = { version = "1.0.4", features = ["uuid1"] } serde = { version = "1.0.144", features = ["derive", "rc"] } serde_json = "1.0.85" tokio = { version = "1.21.0", features = ["macros", "rt-multi-thread"] } From d843bbfc0edf6e35233ac00d725d0631f832abe1 Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Tue, 8 Jul 2025 13:53:19 +0100 Subject: [PATCH 2/2] Apply schemars transforms correctly --- crates/aide/src/axum/inputs.rs | 6 +++++- crates/aide/src/operation.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/aide/src/axum/inputs.rs b/crates/aide/src/axum/inputs.rs index 5f7ac2b5..b2af7697 100644 --- a/crates/aide/src/axum/inputs.rs +++ b/crates/aide/src/axum/inputs.rs @@ -73,7 +73,11 @@ fn operation_input_json( operation: &mut Operation, ) { let json_schema = ctx.schema.subschema_for::(); - let resolved_schema = ctx.resolve_schema(&json_schema); + let mut resolved_schema = ctx.resolve_schema(&json_schema).clone(); + + for transform in ctx.schema.transforms_mut() { + transform.transform(&mut resolved_schema); + } set_body( ctx, diff --git a/crates/aide/src/operation.rs b/crates/aide/src/operation.rs index cffde1f2..ae44aa8a 100644 --- a/crates/aide/src/operation.rs +++ b/crates/aide/src/operation.rs @@ -203,7 +203,11 @@ pub fn parameters_from_schema( schema: Schema, location: ParamLocation, ) -> Vec { - let schema = ctx.resolve_schema(&schema); + let mut schema = ctx.resolve_schema(&schema).clone(); + + for transform in ctx.schema.transforms_mut() { + transform.transform(&mut schema); + } let mut params = Vec::new();