You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vespera automatically generates `multipart/form-data` content type in OpenAPI, and maps `FieldData<NamedTempFile>` to `{ "type": "string", "format": "binary" }`.
191
192
192
-
> **Note:**`axum` must be a direct dependency of your project (not just via vespera) because `TryFromMultipart` internally references `axum::extract::multipart::Multipart`.
193
-
194
193
#### Raw Multipart (Untyped)
195
194
196
195
For dynamic multipart handling where the fields aren't known at compile time, use axum's built-in `Multipart` extractor:
@@ -444,23 +443,23 @@ vespera::schema_type!(Schema from Model, name = "MemoSchema");
444
443
445
444
### Multipart Mode
446
445
447
-
Generate `TryFromMultipart` structs from existing types using the `multipart` keyword:
446
+
Generate `Multipart` structs from existing types using the `multipart` keyword:
448
447
449
448
```rust
450
-
#[derive(TryFromMultipart, vespera::Schema)]
449
+
#[derive(vespera::Multipart, vespera::Schema)]
451
450
pubstructCreateUploadRequest {
452
451
pubname:String,
453
452
#[form_data(limit ="10MiB")]
454
453
pubfile:Option<FieldData<NamedTempFile>>,
455
454
pubdescription:Option<String>,
456
455
}
457
456
458
-
// Generates a TryFromMultipart struct (no serde derives), all fields Optional
457
+
// Generates a Multipart struct (no serde derives), all fields Optional
| Field attrs |`#[serde(...)]` preserved |`#[form_data(...)]` preserved |
481
482
| Relation fields | Included (BelongsTo/HasOne) |**Skipped** (can't represent in forms) |
482
483
|`From` impl | Auto-generated |**Not generated**|
483
484
484
-
**OpenAPI rename alignment:** The schema parser reads `#[form_data(field_name = "...")]` and `#[try_from_multipart(rename_all = "...")]`as fallbacks when serde attrs are absent, ensuring OpenAPI field names match runtime multipart parsing.
485
+
**OpenAPI rename alignment:** The schema parser reads `#[form_data(field_name = "...")]` and `#[serde(rename_all = "...")]`for multipart structs, ensuring OpenAPI field names match runtime multipart parsing.
0 commit comments