NSwag is an OpenAPI toolchain for .NET that provides a suite of generators for converting OpenAPI specifications and JSON schemas into clients, server stubs, and structured documentation. It enables the creation of type-safe client libraries and data transfer objects, as well as the generation of OpenAPI specifications by analyzing .NET controllers.
The project supports contract-first API development by generating server controller stubs from specifications and offers dedicated TypeScript API integration to ensure type safety in frontend applications. It also provides tools for hosting interactive API documentation and specifications to create a browsable map of available service endpoints.
The toolset includes capabilities for code generation, specification management, and HTTP traffic interception. It provides a command-line interface for build pipeline integration, a GUI for managing configurations, and support for defining security schemes such as OAuth2, API keys, and JWT bearer tokens.
The toolchain can be executed via a command-line interface or package manager using configuration-driven workflows stored in JSON files.