I am encountering an error when trying to call the generated Client method. My method takes a RequestDto that has an array property. I get the Exception
public partial class RequestDto
{
public int Emailadress { get; set; }
public string[]? Listing { get; set; }
}
nswag generates the Client with
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponseDto>> SearchAsync(RequestDto req, System.Threading.CancellationToken cancellationToken)
{
if (req == null)
throw new System.ArgumentNullException("req");
var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(req, _settings.Value);
var dictionary_ = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>>(json_, _settings.Value);
var content_ = new System.Net.Http.FormUrlEncodedContent(dictionary_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>> - throw the exception -> Unexpected character encountered while parsing value: [. Path 'Listing', line 3, position 14....
Is there a configuration I need to set or change to be able to use Controllers that use RequestDto having List or Array Properties?
Why is there a Desarialization into a Dictionary<string, string>?
Is there a configuration I can set so the request.Content is set to **json** and not dictionary_?
Thank you
Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))
Hello,
I am encountering an error when trying to call the generated Client method. My method takes a RequestDto that has an array property. I get the Exception
nswag generates the Client with
Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>> - throw the exception -> Unexpected character encountered while parsing value: [. Path 'Listing', line 3, position 14....
Is there a configuration I need to set or change to be able to use Controllers that use RequestDto having List or Array Properties? Why is there a Desarialization into a Dictionary<string, string>? Is there a configuration I can set so the request.Content is set to **json** and not dictionary_?
Thank you
Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))