Skip to content
Open
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
12 changes: 10 additions & 2 deletions crates/aide/src/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,20 @@ where
T: OperationInput,
{
fn operation_input(ctx: &mut crate::generate::GenContext, operation: &mut Operation) {
// Make parameters proudced by T optional if T is wrapped in an Option.
// TODO: we should probably do this for the body as well.
// Make parameters & request body proudced by T optional if T is wrapped in an Option.
let mut temp_op = Operation::default();
T::operation_input(ctx, &mut temp_op);
T::operation_input(ctx, operation);

if let (Some(request_body), Some(_)) = (&mut operation.request_body, temp_op.request_body) {
request_body
.as_item_mut()
.iter_mut()
.for_each(|request_body| {
request_body.required = false;
});
}

if temp_op.parameters.is_empty() {
return;
}
Expand Down