openApiToCSharpClient complex object array binding in request querystring parameter #4377
Unanswered
Buyukcaglar
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@Buyukcaglar have you found any solution to this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In .Net 7 application one of the controllers receive an array of class as querystring parameter. NSwag generated client builds the query as follows;
if (filters != null) { foreach (var item_ in filters) { urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } }
Ofcourse when the request string is being in this way .Net does not bind the filters parameter.
FilterParameter is a simple POCO class with four properties;
public class FilterParameter { public string Name { get; set; } public string Value { get; set; } public string SecondValue { get; set; } public FilterOperator Operator { get; set; } }
Is there are a way to tell Nswag c# code generator to generate request url as below?
?filters[0].Name=Filter1Name&filters[0].Value=Filter1Value&filters[1].Name=Filter2Name&filters[1].Value=Filter2Value
Thank you,
Onur
Beta Was this translation helpful? Give feedback.
All reactions