# ricosuter/nswag

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ricosuter-nswag).**

7,342 stars · 1,354 forks · C# · MIT

## Links

- GitHub: https://github.com/RicoSuter/NSwag
- Homepage: http://NSwag.org
- awesome-repositories: https://awesome-repositories.com/repository/ricosuter-nswag.md

## Topics

`angular` `aspnet` `aspnetcore` `aurelia` `codegen` `csharp` `dotnet` `nswag` `openapi` `swagger` `typescript` `webapi`

## Description

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.

## Tags

### Development Tools & Productivity

- [OpenAPI Toolchains](https://awesome-repositories.com/f/development-tools-productivity/openapi-toolchains.md) — Provides an integrated tool suite for generating OpenAPI specifications and synthesizing client and server code for .NET.
- [API Code Generators](https://awesome-repositories.com/f/development-tools-productivity/api-code-generators.md) — Automatically produces server stubs and controller classes from API interface definitions. ([source](https://github.com/RicoSuter/NSwag/wiki/CSharpControllerGenerator))
- [API-First Development Toolsets](https://awesome-repositories.com/f/development-tools-productivity/compilers-toolchains/source-compilation-tools/source-generators/api-first-development-toolsets.md) — Offers a comprehensive toolset for defining API contracts and generating the corresponding server and client boilerplate.
- [OpenAPI Specification Generators](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/documentation-generators/openapi-specification-generators.md) — Generates structured OpenAPI documentation from .NET controllers to define data contracts for external consumers. ([source](https://github.com/RicoSuter/NSwag/wiki/AspNetCoreOpenApiDocumentGenerator))
- [Template-Based Code Generators](https://awesome-repositories.com/f/development-tools-productivity/template-based-code-generators.md) — Uses predefined patterns to transform API specifications into typed client libraries and server controller stubs.
- [OpenAPI Specification Parsers](https://awesome-repositories.com/f/development-tools-productivity/openapi-specification-parsers.md) — Parses OpenAPI JSON and YAML definitions from URLs or strings into structured internal representations. ([source](https://github.com/RicoSuter/NSwag/wiki/OpenApiDocument))
- [Toolchain Execution Engines](https://awesome-repositories.com/f/development-tools-productivity/toolchain-execution-engines.md) — Executes complex specification and code generation sequences through a command-line interface or package manager. ([source](https://github.com/ricosuter/nswag#readme))
- [Build Pipeline Integrations](https://awesome-repositories.com/f/development-tools-productivity/workflow-automation-tools/build-task-automation/build-pipeline-integrations.md) — Provides command-line tools that can be integrated into build pipelines to keep clients and specs synchronized. ([source](https://github.com/RicoSuter/NSwag/wiki/NSwag.MSBuild))

### Software Engineering & Architecture

- [API Client Generators](https://awesome-repositories.com/f/software-engineering-architecture/api-client-generators.md) — Provides tools to automatically generate type-safe client code from OpenAPI specifications to ensure consistent data structures. ([source](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio))
- [OpenAPI Specification Extraction](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/struct-tags/reflection-based-type-mapping/openapi-specification-extraction.md) — Analyzes .NET assembly types and controller attributes at runtime to automatically extract and produce OpenAPI specifications.
- [Schema-to-Type Mappers](https://awesome-repositories.com/f/software-engineering-architecture/model-import-mappings/json-to-model-mappers/schema-to-type-mappers.md) — Automates the creation of typed data models by converting JSON schema definitions into native language classes.
- [Configuration Workflows](https://awesome-repositories.com/f/software-engineering-architecture/configuration-workflows.md) — Implements an architectural pattern where generation tasks are defined and executed via structured JSON configuration files.
- [Generator Configuration Tools](https://awesome-repositories.com/f/software-engineering-architecture/generator-configuration-tools.md) — Provides a visual GUI for managing and customizing the settings of the code generation engine. ([source](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio))
- [Schema-to-Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-to-code-generators.md) — Generates typed source code implementations from declarative JSON schema definitions to automate data model creation. ([source](https://github.com/RicoSuter/NSwag/wiki/CommandLine))

### Data & Databases

- [Server Stub Generation](https://awesome-repositories.com/f/data-databases/openapi-processors/server-stub-generation.md) — Creates boilerplate server-side code and routing logic from API specifications to enable contract-first development. ([source](https://github.com/ricosuter/nswag#readme))
- [OpenAPI CLI Management Tools](https://awesome-repositories.com/f/data-databases/openapi-processors/openapi-cli-management-tools.md) — Offers a command-line interface to export OpenAPI documents based on configuration files for automated workflows. ([source](https://github.com/RicoSuter/NSwag/wiki/AspNetCore-Middleware))

### Web Development

- [Type-Safe Client Generators](https://awesome-repositories.com/f/web-development/api-client-generators/type-safe-client-generators.md) — Produces type-safe client libraries and data transfer objects from an OpenAPI specification. ([source](https://github.com/RicoSuter/NSwag/wiki/TypeScriptClientGenerator))
- [API Documentation Hosting](https://awesome-repositories.com/f/web-development/api-documentation-hosting.md) — Hosts interactive OpenAPI documentation and specifications to provide a browsable map of available service endpoints. ([source](https://github.com/ricosuter/nswag#readme))
- [OpenAPI to TypeScript Converters](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-to-typescript-converters.md) — Transforms OpenAPI specifications into type-safe TypeScript client libraries and interfaces for frontend integration.
- [API Documentation](https://awesome-repositories.com/f/web-development/api-documentation.md) — Provides interactive interfaces for exploring and testing backend service endpoints through hosted OpenAPI documentation.
- [API Endpoint Metadata](https://awesome-repositories.com/f/web-development/api-endpoint-metadata.md) — Allows attachment of structural and descriptive metadata to routes via attributes for API documentation. ([source](https://github.com/RicoSuter/NSwag/wiki/WebApiOpenApiDocumentGenerator))
- [OpenAPI Response Definitions](https://awesome-repositories.com/f/web-development/api-management-tools/api-development-management/api-documentation/openapi-response-definitions.md) — Generates JSON schemas for data objects and specifies response types to document the API data contract. ([source](https://github.com/RicoSuter/NSwag/wiki/AspNetCoreOpenApiDocumentGenerator))
- [Configuration-Driven Generators](https://awesome-repositories.com/f/web-development/api-management-tools/api-development-management/api-generation/dynamic-rest-api-generators/repository-based-generators/configuration-driven-generators.md) — Automates the generation process using predefined instructions stored in JSON configuration documents. ([source](https://github.com/RicoSuter/NSwag/wiki/CommandLine))
- [OpenAPI Specification Generators](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-specification-generators.md) — Automatically derives OpenAPI specifications from .NET assembly types and controller metadata. ([source](https://github.com/ricosuter/nswag#readme))

### Networking & Communication

- [Middleware-Based Request Pipelines](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/request-processing-architectures/request-processing/middleware-based-request-pipelines.md) — Provides a modular pipeline to intercept and modify outgoing HTTP requests and incoming responses for logging and error handling.

### Security & Cryptography

- [HTTP Authentication Schemes](https://awesome-repositories.com/f/security-cryptography/http-authentication-schemes.md) — Defines authentication requirements for API operations using standard schemes like OAuth2, API Keys, and JWT Bearer tokens. ([source](https://github.com/RicoSuter/NSwag/wiki/AspNetCore-Middleware))
