autogenerate-api-client-with-nswag icon indicating copy to clipboard operation
autogenerate-api-client-with-nswag copied to clipboard

How to Generate Interfaces in Angular from Models Using NSwag

Open MehdiElMellali opened this issue 5 months ago • 0 comments

Description:
I am currently working on an Angular project where I need to generate TypeScript interfaces from C# models using NSwag. I have successfully set up NSwag in my project, but I'm unsure about the specific steps to configure it to generate the necessary interfaces for Angular.

Key Points:

  • I have C# models that I want to convert into TypeScript interfaces.
  • I'm using NSwag for client generation.
  • I'm familiar with the Swagger specification, but I need guidance on how to map the models to TypeScript interfaces effectively.

Questions:

  1. What configuration steps are required in NSwag to generate TypeScript interfaces for Angular from C# models?
  2. Is there a specific NSwag command or configuration in the nswag.json file to enable this?
  3. Can the output files (interfaces) be customized in terms of their folder structure in the Angular project?
  4. Are there any additional steps required in the Angular project to integrate the generated interfaces?

Project Environment:

  • Angular version: 15
  • NSwag version: 14.0.7
  • .NET : 8

Any guidance or example configurations would be greatly appreciated.

Thank you!

MehdiElMellali avatar Sep 22 '24 17:09 MehdiElMellali