Skip to content

Commit

Permalink
feat: impl OperationInput for axum_extra::extract::JsonDeserializer
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbz00 committed Oct 21, 2024
1 parent 2bad9ab commit 5e358e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/aide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ axum-extra-cookie = ["axum", "axum-extra", "axum-extra/cookie"]
axum-extra-cookie-private = ["axum", "axum-extra", "axum-extra/cookie-private"]
axum-extra-form = ["axum", "axum-extra", "axum-extra/form"]
axum-extra-query = ["axum", "axum-extra", "axum-extra/query"]
axum-extra-json-deserializer = ["axum", "axum-extra", "axum-extra/json-deserializer"]
axum-wasm = ["axum"]


Expand Down
13 changes: 11 additions & 2 deletions crates/aide/src/axum/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::{
use axum::{
body::Body,
extract::{
Extension, Form, Host, Json, MatchedPath, OriginalUri, Path, Query, RawQuery,
State,
Extension, Form, Host, Json, MatchedPath, OriginalUri, Path, Query, RawQuery, State,
},
};

Expand Down Expand Up @@ -108,6 +107,16 @@ where
}
}

#[cfg(feature = "axum-extra-json-deserializer")]
impl<T> OperationInput for axum_extra::extract::JsonDeserializer<T>
where
T: JsonSchema,
{
fn operation_input(ctx: &mut crate::gen::GenContext, operation: &mut Operation) {
Json::<T>::operation_input(ctx, operation);
}
}

impl<T> OperationInput for Form<T>
where
T: JsonSchema,
Expand Down

0 comments on commit 5e358e5

Please sign in to comment.