In my project, I am using an ASP.Net Core 3.1 backend and a Typescript 3.8 front end.
I have been trying to configure NSwag to include authorization headers by following the guidelines provided in this documentation: https://github.com/RicoSuter/NSwag/wiki/TypeScriptClientGenerator#inject-an-authorization-header
(I've used the exact code snippet from the extensionCode file as suggested)
However, after NSwag generates the TypeScript output file, the extensionCode is placed at the bottom of the file. This causes issues with referencing the classes generated above it, resulting in TypeScript compilation errors. Manually moving the code to the top resolves the issue.
I noticed in the NSwag code that there may be a way to ensure that the extension code renders at the top using 'extendedClasses', but despite my attempts, I haven't been successful. I also tried adding 'extends generated.[Class Name]' as recommended in some sources, but that didn't work either (or perhaps I was implementing it incorrectly).
Can anyone provide suggestions on how I can resolve this issue and get the setup working smoothly?
Edit: Before I forget, here's a link to my nswag.json file: https://gist.github.com/mattgrande/075f05177191bf8daffbf51609e40267