RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.23k forks source link

Typescript client: DateOnly is not handled in Form parameters #4295

Open Shaddix opened 1 year ago

Shaddix commented 1 year ago

In Client.RequestBody.liquid theres a special handling for IsDateOrDateTime, but DateOnly has to be handled using formatDate.

{%-             elsif parameter.IsDateOrDateTime -%}
    content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent({{ parameter.VariableName }} ? "" + {{ parameter.VariableName }}.toJSON() : "{{ QueryNullValue }}") + "&";

I will provide PR coming days

Shaddix commented 1 year ago

PR is provided

pinkfloydx33 commented 5 months ago

Any movement on this? In aspnetcore, DateOnly.Parse will throw an exception if the time component is in the value which either causes a 400 BadRequest or silently ignores the entire value depending on if it's a form body value, query parameter, etc. It'd be great if this could be fixed.