NSwag is a Swagger/OpenAPI toolchain for .NET, ASP.NET Core, and TypeScript that generates API specifications and client code.
NSwag solves the problem of keeping API documentation and client libraries in sync by automating the generation of OpenAPI specifications from ASP.NET controllers and then generating strongly-typed client code from those specifications. The tool combines the functionality of Swashbuckle for specification generation and AutoRest for client generation into a single integrated toolchain, eliminating the need for both libraries separately. It uses NJsonSchema for JSON Schema handling and supports features like inheritance, enums, and reference handling that may not be well-represented in the OpenAPI specification alone.
Teams building .NET backends with TypeScript frontends should consider NSwag if they want to eliminate manual synchronization between server and client APIs. The tool suits projects using ASP.NET or ASP.NET Core controllers and supports generating clients for multiple TypeScript frameworks including Angular, Aurelia, jQuery, and KnockoutJS. It can be integrated into development workflows through multiple entry points: a Windows GUI called NSwagStudio, ASP.NET Core middleware that serves specifications alongside Swagger UI or ReDoc, command-line tools available via NuGet or NPM, direct C# code invocation, or MSBuild targets. The README does not compare NSwag to other tools in its category.
The project maintains active development with regular updates and improvements. The codebase shows ongoing refinement of core functionality and expansion of integration options. Community contributions are accepted alongside the primary maintainer's work. The tool is distributed through multiple channels including NuGet packages, NPM, and as a standalone Windows application, indicating sustained investment in accessibility across different development environments.