-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenApi with multipart & TempFile #120
Comments
Btw the manual implementation works fine in swagger : impl ApiComponent for UploadForm {
fn content_type() -> String {
"multipart/form-data".to_string()
}
fn child_schemas() -> Vec<(String, ReferenceOr<Schema>)> {
vec![]
}
fn schema() -> Option<(String, ReferenceOr<Schema>)> {
Some((
"UploadForm".to_string(),
apistos::reference_or::ReferenceOr::Object(Schema::Object(SchemaObject {
instance_type: Some(SingleOrVec::Single(Box::new(InstanceType::Object))),
object: Some(Box::new(ObjectValidation {
properties: {
let mut map = Map::new();
map.insert(
"main".to_string(),
Schema::Object(SchemaObject {
instance_type: Some(SingleOrVec::Single(Box::new(
InstanceType::String,
))),
format: Some("binary".to_string()),
..Default::default()
}),
);
map.insert(
"dependencies".to_string(),
Schema::Object(SchemaObject {
instance_type: Some(SingleOrVec::Single(Box::new(
InstanceType::Array,
))),
array: Some(Box::new(ArrayValidation {
items: Some(SingleOrVec::Single(Box::new(Schema::Object(
SchemaObject {
instance_type: Some(SingleOrVec::Single(Box::new(
InstanceType::String,
))),
format: Some("binary".to_string()),
..Default::default()
},
)))),
min_items: Some(0),
..Default::default()
})),
..Default::default()
}),
);
map
},
required: ["main".to_string()].into_iter().collect(),
..Default::default()
})),
..Default::default()
})),
))
}
} |
Hi ! Unfortunately you may need to wait a few weeks until @rlebran is back to get a definitive answer. But by any chance did you also try to do it using apistos I am under the impression it will work in this upcoming version (but I did not have time to do a complete test). |
Hi :) No worries since I have a backup solution with the manual impl it's fine. |
Hi ! Sadly schemars doesn't provide a If I think of a solution I will keep you updated. In the meantime I will keep the issue open for reference. |
Hello,
I would like to generate an openapi def for this struct:
Unfortunately I'm stuck on how to do that, obviously I cannot use JsonSchema since it doesn't work with TempFile.
Any help would be really appreciated.
Thank you
The text was updated successfully, but these errors were encountered: