-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Refitter fails to generate FormData parameter for file upload #62
Comments
@richardhu-lmg thanks for taking the time to report this. Multi-part upload support is currently not implemented yet but I will add it to my to-do list |
Any estimate re when the fix will be implemented? |
@richardhu-lmg Sorry, I can't really honestly say when I'll implement this. I'll try looking into how complex this is tonight, and if it's simple enough, it will probably be done in a few minutes or hours. Otherwise, it will be completed when I find the time. @richardhu-lmg You are more than welcome to give it a shot yourself and create a pull request, I'm very open and lenient regarding pull requests |
@all-contributors please add @richardhu-lmg for bugs |
I've put up a pull request to add @richardhu-lmg! 🎉 |
I have an implementation where the following OpenAPI v3 specifications {
"openapi":"3.0.2",
"paths":{
"/foo/{id}/files":{
"post":{
"summary":"uploads a file",
"operationId":"uploadFile",
"parameters":[
{
"name":"id",
"in":"path",
"description":"Id of the foo resource",
"required":true,
"schema":{
"type":"integer",
"format":"int64"
}
}
],
"requestBody":{
"content":{
"multipart/form-data":{
"schema":{
"type":"object",
"properties":{
"formFile":{
"type":"string",
"format":"binary"
}
}
},
"encoding":{
"formFile":{
"style":"form"
}
}
}
}
},
"responses":{
"200":{
"description":"successful operation"
}
}
}
}
}
} Generates the following Refit interface public interface IApiClient
{
[Multipart]
[Post("/foo/{id}/files")]
Task UploadFile(long id, StreamPart formFile);
} @richardhu-lmg Will this work for you? |
Describe the bug
Refitter ignores the IFormFile parameter decorated with [FromForm] which is used for receiving file upload.
The controller parameter is completely missed in the generated refit interface method.
If it worked, the generated method would have [Multipart] as method annotation and StreamPart as the type for IFormFile parameter
https://github.com/reactiveui/refit#multipart-uploads
Support Key:
8hz0dgn
OpenAPI Specifications
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"formFile": {
"type": "string",
"format": "binary"
}
}
},
"encoding": {
"formFile": {
"style": "form"
}
}
}
}
}
Additional context
The text was updated successfully, but these errors were encountered: