Dreamescaper / GenerateAspNetCoreClient

DotNet tool to generate HTTP client classes from ASP.NET Core api controllers.
MIT License
63 stars 5 forks source link

Parameter generation error when model contains IFormFile #13

Open MarkJosephCabana opened 1 year ago

MarkJosephCabana commented 1 year ago

The generated method contains an extra Multipartitem param when you add an IFormFile property as the 1st property. to replicate: namespace TestWebApi.Models { public class SomeQueryModel { public IFormFile File { get; set; } //must be the first prop public string Param1 { get; set; } public Guid? Param2 { get; set; } public int Param3 { get; set; } } }

then the code generated will be something like: [Multipart] [Post("/WeatherForecast/form")] Task WithFormParam(MultipartItem formParam = null, [Body(BodySerializationMethod.UrlEncoded)] SomeQueryModel formParam = null);

Dreamescaper commented 1 year ago

What is the expected behavior? You need MultipartItem parameter to be able to pass file which Refit will understand. I doubt that Refit knows what to do with IFormFile.