Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON reviver being ignored if Axios is used #5003

Open
aeslinger0 opened this issue Oct 18, 2024 · 1 comment
Open

JSON reviver being ignored if Axios is used #5003

aeslinger0 opened this issue Oct 18, 2024 · 1 comment

Comments

@aeslinger0
Copy link

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 #4973, #4468, #4134, and #4112

@aeslinger0
Copy link
Author

I found a 4 year old PR that looks like it might fix this issue and at least 5 other open issues, but it was never merged: #2927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant