#[derive(Multipart)]
{
// Attributes available to this derive:
#[schema]
}
Available on crate feature
macro only.Expand description
Define a request body with multipart/form-data media type.
This macro will generate 5 implementations, FromRequest, ApiRequest, MediaType, RequestMediaType and SingleMediaType.
§Example
use predawn::{
extract::multipart::{JsonField, Multipart, Upload},
ToSchema,
};
use serde::Deserialize;
#[derive(ToSchema, Multipart)]
pub struct SomeMultipart {
person: JsonField<Person>,
message: String,
files: Vec<Upload>,
}
#[derive(ToSchema, Deserialize)]
pub struct Person {
name: String,
age: u8,
}§Note
structs can only be annotated with Multipart derive macro if all of their fields implement the ParseField trait.