Replies: 1 comment 2 replies
-
I belive it should be doable with something like this definition: #[utoipa::path(
request_body(content = WhatEverStruct, description = "Multipart file", content_type = "multipart/form-data"),
)] |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was looking at the latest path attribute macro documentation on docs.rs (utoipa-3.4.4) but could not find how to specify that a function could accept a request body with data with content type
multipart/form-data
.For context, I am using utoipa to generate an OpenAPI spec to generate a typescript client to talk to my rust web server running actix-web. I intend to use
multipart/form-data
to upload a single file from the browser. I have considered trying to make an endpoint on my actix-web server to accept a raw file, but I struggle with annotating (with utoipa) the fact that multiple specific types of files can be uploaded and I have to resort toapplication/octet-stream
to catch all file/content types and then use sniffing to deduce the content type uploaded. An endpoint that takesmultipart/form-data
would allow me to inspect the content type of the uploaded content easily.Beta Was this translation helpful? Give feedback.
All reactions