NSwag
NSwag copied to clipboard
System.Text.Json sometimes generated a client with mixed references
See, screenshot. The Serializeroptions are correctly using System.Text.Json, while the Serialize itself references the old Newtonsoft. Feel free to PM me for a repro.
Experiencing the same issue today
@oduis Is your API specification file large? The one I am dealing with is over 4MB and I suspect that may be the issue.
Mine is small, just 10kB.
OK I think I figured it out...
If you look at https://github.com/RicoSuter/NSwag/blob/v13.15.10/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid#L208 it would appear that NSWAG always uses Newtonsoft when dealing with operations that consume "application/x-www-form-urlencoded".
Technically, NSWAG advertises System.Text.Json
support as "experimental/incomplete" so this must be an example of that
This issue is affecting me as well and took some time to track down.
This bug was caused by this PR: https://github.com/RicoSuter/NSwag/pull/3309
But there is a PR with the fix already here: https://github.com/RicoSuter/NSwag/pull/4172
@RicoSuter - Could you take a look at this PR ^^. Seems like a straightforward fix.
It looks like it was fixed by #4402 @oduis can you test it with v13.18.3 or later?
Just tested, looks great now, thanks!