You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code generated with NSwag.ApiDescription.Client 14.4.0 generates urls with enumerable int parameters a way that the standard WebApi model binder cannot handle.
using System.Globalization;
var builder144 = new System.Text.StringBuilder();
int[]? fundingSchemeIds = { 1, 2, 3 };
if (fundingSchemeIds != null)
{
builder144.Append(System.Uri.EscapeDataString("FundingSchemeIds") + "=");
foreach (var item_ in fundingSchemeIds)
{
builder144.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(",");
}
builder144.Length--;
builder144.Append("&");
}
Console.WriteLine("{0} // 14.4.0", builder144);
var builder143 = new System.Text.StringBuilder();
if (fundingSchemeIds != null)
{
foreach (var item_ in fundingSchemeIds) { builder143.Append(System.Uri.EscapeDataString("FundingSchemeIds")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); }
}
Console.WriteLine("{0} // 14.3.0", builder143);
Console.Read();
string ConvertToString(int i, CultureInfo cultureInfo)
{
return $"{i}";
}
Output
FundingSchemeIds=1,2,3& // 14.4.0 --> nok
FundingSchemeIds=1&FundingSchemeIds=2&FundingSchemeIds=3& // 14.3.0 --> ok
Visual Studio 2022 (Version 17.13.6) right click on project using the service > Add > Connected Service > Service References > (Existing) Refresh
Expected behavior
The url generated in the client still works as it did before in Version 14.3.0
The text was updated successfully, but these errors were encountered:
rainerbossert
changed the title
Code generated by NSwag.ApiDescription.Client generates incorrect URLs
Code generated by NSwag.ApiDescription.Client 14.4.0 generates incorrect URLs
May 7, 2025
The query format FundingSchemeIds=1,2,3 does not correctly bind to IEnumerable fundingSchemeIds in ASP.NET Core (.NET 6+). The default model binder expects repeated parameters like FundingSchemeIds=1&FundingSchemeIds=2&FundingSchemeIds=3 for correct binding.
We found out the same issue. This is extremely breaking. Makes the generated C# clients useless because MS want it done differently as described by bifa-zuehlke.
Describe the bug
Code generated with NSwag.ApiDescription.Client 14.4.0 generates urls with enumerable int parameters a way that the standard WebApi model binder cannot handle.
Output
While the endpoint looks like
Somehow similar to: #5096 (but the version 14.2.0 seems off).
Version of NSwag toolchain, computer and .NET runtime used
Nuget package NSwag.ApiDescription.Client --version 14.4.0
To Reproduce
Visual Studio 2022 (Version 17.13.6) right click on project using the service > Add > Connected Service > Service References > (Existing) Refresh
Expected behavior
The url generated in the client still works as it did before in Version 14.3.0
The text was updated successfully, but these errors were encountered: