Open RicoSuter opened 5 years ago
@pranavkm what do you think?
Hi,
I did a repository too where you can see the problem: https://github.com/ranouf/TestMultipleUpload
I think there it could exist bug on both side (server & client). For server, I created an issue here: https://github.com/dotnet/core/issues/1967. For client, here: https://github.com/RSuter/NSwag/issues/1633
Currently the client generated by nswag generates wrong service, I m not able to get the string values or IFormFile values server side (even in the HttpContext). So I overwrited the method and now, all the values are sent to the server. I can see the string values correctly binder to the DTO but not the IFormFile (but they are in the HttpContext).
Let me know for any updates, I m interested to get a working solution :)
It s confirmed, there is a bug with IFormFile binding on .net core 2.1 (https://github.com/aspnet/Mvc/issues/8527#issuecomment-425978956).
A fix has been proposed and it s available on the nightly builds.
I uploaded my repository (https://github.com/ranouf/TestMultipleUpload) to get the last version of .net Core, but I continue to have some issues, maybe the request is not correctly configured.
I will let you know when I will have more details.
Hi,
So finally there were no issue from .Net Core. It's more things we need to know when we send Data and Files to a .net Core API.
From client side, we need to:
name: Parent1 files: (binary) files: (binary) children[0].name: Child1 children[0].files: (binary) children[0].files: (binary) children[1].name: Child2 children[1].files: (binary) children[1].files: (binary) children[1].files: (binary)
from server side, what we need to know:
My suggestion for NSwag,
@RSuter let me know if it helps you to improve NSwag or if you have any questions :)
Not working:
Output:
Working as expected:
Output:
I'd expect api explorer to handle a complex parameter as a collection of params and not a single complex param if a property is of type IFormFile...
Repro: https://github.com/jeremyVignelles/TestNSwagNetCoreApp/tree/repro/iFormFile
/cc @jeremyVignelles