Open qrilka opened 9 months ago
Here is a spec that show the problem if it would be helpful openapi.json
I have no idea if this might be helpful but it's what copilot says in the interface about that TODO line:
{{#supportAsync}}
let mut local_var_form = reqwest::multipart::Form::new();
{{#formParams}}
{{#isFile}}
if let Some(local_var_file_path) = {{{paramName}}} {
match tokio::fs::File::open(local_var_file_path).await {
Ok(file) => {
let form_part = reqwest::multipart::Part::stream(file);
local_var_form = local_var_form.part("{{{baseName}}}", form_part);
},
Err(err) => {
return Err(Error::FileOpenError(err));
}
}
}
{{/isFile}}
{{/formParams}}
local_var_req_builder = local_var_req_builder.multipart(local_var_form);
{{/supportAsync}}
This is still a problem on 7.9.0
but I haven't tried main.
Bug Report Checklist
Description
It's not clear how the project documents file upload support. But according to https://openapi-generator.tech/docs/generators/rust/ both
File
data type andFormMultipart
are implemented. In practice the generated code contains just a TODO. Side comment: file parameter becomes encoded asfile: std::path::PathBuf
which makes it impossible to use the generated code from WASM.openapi-generator version
Also checked the latest templates in
master
OpenAPI declaration file content or url
Generation Details
In the generated Rust code I see
Reflecting the template https://github.com/OpenAPITools/openapi-generator/blob/783e68c7acbbdcbb2282d167d1644b069f12d486/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache#L269
Steps to reproduce
Create an endpoint with response body with
"content": "multipart/form-data"
and containing file parameter with format "binary", and type "string. Run Rust generator for this API spec.Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/16167
Suggest a fix
Create an explicit ticket about file support implementation and make it visible on the website that it's still missing.