NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

JSON reviver being ignored if Axios is used

Open aeslinger0 opened this issue 4 months ago • 1 comments

I recently switched from using Fetch to Axios so that I could use interceptors and I noticed that my reviver function that I'm using to parse date strings into Date objects is not being used anymore. The generated code does not seem to pass it into the JSON.Parse() function.

NSwag either needs an option to disable JSON.Parse() so I can handle it in my interceptors/transformResponse within Axios, or it should use the reviver if it is specified. Or perhaps both.

Without one of these options, either the data isn't transformed or an error is thrown as both Axios and NSwag will run duplicate JSON.Parse() calls.

I believe this might address https://github.com/RicoSuter/NSwag/issues/4973, https://github.com/RicoSuter/NSwag/issues/4468, https://github.com/RicoSuter/NSwag/issues/4134, and https://github.com/RicoSuter/NSwag/issues/4112

aeslinger0 avatar Oct 18 '24 21:10 aeslinger0