Skip to content
CAI
Software that uses CAICheck a score

RicoSuter/NSwag

49.3

Weak · 23 September 2026

21.8k

lines of production code

C#

with JavaScript

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is NSwag, a comprehensive toolchain for generating OpenAPI and Swagger specifications from .NET applications and producing client or controller code in C\# and TypeScript. It provides middleware integrations for ASP.NET Core, OWIN, and Web API to serve interactive API documentation via Swagger UI and ReDoc. The system also includes command-line and desktop interfaces for configuring generation pipelines, managing build-time code generation via MSBuild and NPM, and handling YAML serialization.

How it got here

2015–2016 — OpenAPI 3 migration and .NET 10 support

29 changes.

The project underwent a significant architectural shift to support OpenAPI 3.0 specifications, replacing legacy Swagger attributes with new OpenApi-prefixed models and updating core serialization logic. Concurrently, the toolchain was modernized to target .NET 8, 9, and 10, introducing cross-platform console support, MSBuild integration, and enhanced UI capabilities in NSwagStudio for multi-document workflows and diverse input sources.

2017–2018 — Code generation refactoring and CLI expansion

25 changes.

This period focused on restructuring the C\# and TypeScript code generators by modularizing templates and models to improve maintainability and support for modern frameworks. It also introduced significant CLI enhancements, including new commands for configuration and execution, alongside expanded test coverage and middleware refinements for ASP.NET Core and OWIN.

2019 — ASP.NET Core generation and YAML support

29 changes.

This period focused on introducing native ASP.NET Core support for OpenAPI document generation, including a new CLI tool and dedicated generator classes that leverage the framework's API description infrastructure. The codebase also added YAML serialization capabilities and refactored the generation pipeline with an extensible processor architecture to improve metadata handling, nullability, and security scope mapping.

2020–2025 — .NET 10 support and build migration

10 changes.

The project modernized its infrastructure by migrating the build and CI pipeline to NUKE with .NET 10 support, while inlining the NConsole library for better command-line control. Significant effort was dedicated to ensuring compatibility across .NET 8, 9, and 10 through new sample applications, updated snapshot tests, and fixes for OpenAPI parameter serialization.

Features

Add .NET 10 sample applications

Added new sample projects for NSwag targeting the .NET 10 runtime. The \NSwag.Sample.NET100\ project demonstrates a traditional ASP.NET Core setup with controllers, JSON serialization options, and OpenAPI document generation. The \NSwag.Sample.NET100Minimal\ project showcases a minimal API approach, including route definitions and Swagger UI integration. Both samples include necessary configuration files and generated OpenAPI specifications to serve as reference implementations for .NET 10 compatibility.

src/NSwag.Sample.NET100, src/NSwag.Sample.NET100Minimal · high confidence

Add .NET 8 minimal API sample project

A new sample project targeting .NET 8 has been added to demonstrate NSwag integration with minimal APIs. It includes a Program.cs file that configures OpenAPI document generation and serves the Swagger UI, along with sample endpoints for basic operations and controller-based routes. The project also provides the necessary configuration files (nswag.json, launchSettings.json) and a pre-generated OpenAPI document to illustrate how NSwag works in a .NET 8 environment.

src/NSwag.Sample.NET80Minimal, src/NSwag.Sample.NET90Minimal · high confidence

Add .NET 8.0 sample controller with diverse route patterns

A new ValuesController has been added to the NSwag.Sample.NET80 project to serve as a test fixture for the .NET 8.0 target framework. This controller exposes a variety of API endpoints, including standard CRUD operations and specific route patterns such as 'ToString({id})' and 'id:{id}', which are used to validate path parameter parsing and OpenAPI generation for complex URL structures.

src/NSwag.Sample.NET80/Controllers · high confidence

Add .NET 9 sample application

A new sample project targeting .NET 9 has been added to demonstrate NSwag integration with the latest runtime. The sample includes a standard ASP.NET Core host and startup configuration, utilizing NJsonSchema for null-handling settings and exposing Swagger/OpenAPI documentation via the Apimundo service. It also provides a pre-configured nswag.json file for generating TypeScript and C\# client code, serving as a reference implementation for .NET 9 environments.

src/NSwag.Sample.NET80, src/NSwag.Sample.NET90 · high confidence

Add ASP.NET Core test web application for API versioning and custom formatters

A new test web application project has been added to support testing NSwag generation with ASP.NET Core API versioning and custom input/output formatters. The application registers custom text formatters to handle specific media types (text/html, foo/bar) and configures API versioning with URL segment reading. It exposes three distinct Swagger document versions (v1, v2, v3) mapped to corresponding API groups, allowing tests to verify versioned API documentation generation. The setup includes standard ASP.NET Core hosting, HTTPS redirection, and Swagger UI integration.

src/NSwag.Generation.AspNetCore.Tests.Web · high confidence

Add JsonExceptionFilterAttribute for Web API exception handling

The new JsonExceptionFilterAttribute in NSwag.AspNet.WebApi automatically serializes unhandled exceptions from action methods into JSON responses with the correct HTTP status code. It supports hiding stack traces for security, searching specific namespaces for exception types, and determining the status code by inspecting SwaggerResponseAttribute or ResponseTypeAttribute on the action method.

src/NSwag.AspNet.WebApi · high confidence

Add sample API controller for NSwag.NET90

A new ValuesController has been added to the NSwag.Sample.NET90 project, providing a standard RESTful API endpoint structure. This controller exposes actions for retrieving, creating, updating, and deleting resources, including specific handling for Person objects and TestEnum values, serving as a test fixture for the .NET 9 sample application.

src/NSwag.Sample.NET90/Controllers · high confidence

Added ASP.NET Core generator and Swagger input handling to the UI

The NSwagStudio interface now includes a dedicated view model for the ASP.NET Core Swagger generator, exposing configuration options for reference type null handling, new line behavior, and output schema types (Swagger 2.0 or OpenAPI 3). Additionally, a new Swagger input view model allows users to load Swagger documents from URLs or local files, automatically formatting the JSON for display.

src/NSwagStudio/ViewModels/SwaggerGenerators · high confidence

Added NSwag Metro-style icon asset

A new Metro-style icon asset (NSwagIcon.metrop) has been added to the assets folder, providing a 256x256 square icon with a green background and white content for use in the application's UI or packaging.

assets · high confidence

Added ObservableDictionary and collection extension methods

The NSwag.Core library now includes a new \ObservableDictionary\<TKey, TValue\>\ class that implements \INotifyCollectionChanged\ and \INotifyPropertyChanged\, allowing consumers to react to changes in key-value pairs. Additionally, a new \Extensions\ class provides custom LINQ-style methods (\Any\, \Count\, \FirstOrDefault\, \All\) for \List\<T\>\ and \Dictionary\<TKey, TValue\>\, enabling null-safe filtering and enumeration without relying on \System.Linq\.

src/NSwag.Core/Collections · high confidence

Added common sample models for station and weather data

The \src/NSwag.Sample.Common\ project now includes shared data models used by the sample application, specifically \Station\, \WeatherForecast\, \FileType\, and \ExtensionData\. These classes define the structure for weather forecast data (including temperature conversions and station details) and support serialization behaviors like conditional property serialization.

src/NSwag.Sample.Common · high confidence

Added new test controllers for API versioning, Swagger extension data, and XML documentation

The test web application now includes several new controller classes to support specific NSwag generation scenarios. VersionedValuesController and VersionedV3ValuesController implement ASP.NET Core API versioning, with VersionedValuesController explicitly marking version 2 as deprecated to test deprecation flags. SwaggerExtensionDataController demonstrates the use of SwaggerExtensionData attributes at the controller, action, and parameter levels. ResponsesController and LanguagesController provide additional endpoints for testing response descriptions and route constraints. XmlDocsController includes a model with XML summary comments to verify that XML documentation is correctly processed and included in the generated Swagger output.

src/NSwag.Generation.AspNetCore.Tests.Web/Controllers · high confidence

Core OpenAPI model classes and serialization logic added

The NSwag.Core library now includes the foundational model classes for OpenAPI specifications, such as OpenApiDocument, OpenApiComponents, OpenApiOperation, and OpenApiCallback, along with their JSON serialization logic. This change introduces the internal structure required to represent and serialize Swagger 2.0 and OpenAPI 3.0 documents, including support for components like schemas, request bodies, and security schemes, as well as utility classes for HTTP status code validation and external initialization.

src/NSwag.Core · high confidence

Initial Chocolatey package definition for NSwagStudio

Added the foundational files for the NSwagStudio Chocolatey package, including the nuspec manifest, installation and uninstallation PowerShell scripts, a build script, and license/verification text. This enables users to install the NSwagStudio desktop application via the Chocolatey package manager.

src/NSwagStudio.Chocolatey · high confidence

Initial release of NSwag.MSBuild package with .NET 8, 9, and 10 support

The NSwag.MSBuild NuGet package is introduced, providing MSBuild props and tools to integrate NSwag code generation into .NET projects. The package bundles the NSwag console executables for Windows and the dotnet-nswag tool for .NET 8, .NET 9, and .NET 10, allowing users to generate OpenAPI/Swagger clients and controllers directly during the build process.

src/NSwag.MSBuild · high confidence

Initial release of the NSwagStudio desktop application UI

This change introduces the primary user interface for the NSwagStudio desktop application, establishing the main window layout and the document editing view. Users can now open, create, and manage multiple Swagger/OpenAPI documents via a tabbed interface, configure input settings such as runtime and default variables, and select output code generators. The UI includes a 'Generate Outputs' button for previewing results and a 'Generate Files' button for writing generated code to disk, along with standard file operations (New, Open, Save, Close) and window state persistence.

src/NSwagStudio/Views · high confidence

Initial repository structure and build configuration

The repository is initialized with the core NSwag toolchain, including the .NET solution, source code, and documentation. Build automation is established via NUKE scripts (build.ps1, build.sh) and Azure Pipelines, targeting .NET SDK 10.0.100. The project is configured with .NET 10 support, implicit usings, and strict analyzer settings, while the license is set to MIT.

(repo-wide) · high confidence

Introduction of .NET Core console host and cross-platform publishing support

The NSwag.ConsoleCore project now includes a dedicated CoreConsoleHost implementation and Program entry point to enable execution on .NET Core, replacing or supplementing previous hosting mechanisms. This change introduces support for async command processing via NSwagCommandProcessor and adds a Publish.bat script to build and publish the tool for multiple operating systems (Windows, macOS, Linux) and architectures, ensuring broader platform compatibility for end-users.

src/NSwag.ConsoleCore · high confidence

NSwag Commands project initialization and core CLI infrastructure

This change introduces the \NSwag.Commands\ project, establishing the foundational structure for the NSwag command-line tooling. It adds the \NSwagCommandProcessor\ to handle CLI argument processing and execution, and defines the \NSwagDocument\ and \NSwagDocumentBase\ classes to manage configuration loading, environment variable expansion, and document execution. The update includes \CodeGeneratorCollection\ and \OpenApiGeneratorCollection\ to organize TypeScript, C\# client, and controller generation commands, alongside \HostApplication\ and \HostFactoryResolver\ to resolve ASP.NET Core service providers for runtime document generation. Additionally, it introduces a \version\ command to display toolchain versions, \NewLineBehavior\ settings for output formatting, and \PathUtilities\ for handling file paths and wildcards.

src/NSwag.Commands · high confidence

NSwagStudio now supports .NET 8, 9, and 10 runtimes

The NSwagStudio command-line interface (nswag.cmd) has been updated to allow users to explicitly select the .NET runtime for code generation. Users can now pass /runtime:net80, /runtime:net90, or /runtime:net100 arguments to execute the generator using the corresponding .NET 8, 9, or 10 runtimes, in addition to the existing default and x86 options. This change enables the studio to leverage newer runtime capabilities for Swagger generation tasks.

src/NSwagStudio · high confidence

New 'nswag new' and 'nswag run' CLI commands

Users can now generate a default nswag.json configuration file using the 'nswag new' command and execute NSwag document files using the 'nswag run' command. The 'run' command supports specifying an input file, automatically processing all .nswag files in the current directory, and passing variables to the document execution.

src/NSwag.Commands/Commands/Document · high confidence

New Apimundo UI integration and enhanced Swagger UI configuration options

This release introduces a new Apimundo UI integration, allowing users to compare API specifications via the Apimundo service using the new ApimundoUiSettings class. It also adds several configuration options for the Swagger UI, including support for custom inline styles, custom CSS/JavaScript paths, and the ability to enable module-type scripts for custom JavaScript. Additionally, the OAuth2 client settings now support PKCE (Proof Key for Code Exchange) for the authorization code grant flow, and the middleware now correctly handles reverse proxy scenarios by respecting X-Forwarded-\* headers for base path and scheme determination.

src/NSwag.AspNetCore · high confidence

New AspNetCore CLI command for generating OpenAPI specifications

This change introduces the \aspnetcore2openapi\ command-line tool, allowing users to generate Swagger/OpenAPI specifications directly from ASP.NET Core projects. The implementation includes a new MSBuild targets file (\AspNetCore.targets\) to extract project metadata (such as output paths and framework identifiers) and a command handler (\AspNetCoreToOpenApiCommand\) that orchestrates the build and generation process. It supports both .NET Framework and .NET Core/5+ runtimes, handling executable launching and argument parsing via a dedicated \Exe\ helper, and provides an in-process entry point for scenarios where external process execution is not desired.

src/NSwag.Commands/Commands/Generation/AspNetCore · high confidence

New AspNetCoreOpenApiDocumentGenerator and settings for ASP.NET Core API generation

The \NSwag.Generation.AspNetCore\ package now introduces the \AspNetCoreOpenApiDocumentGenerator\ class and its associated \AspNetCoreOpenApiDocumentGeneratorSettings\. This new generator creates OpenAPI documents by leveraging the ASP.NET Core \ApiDescription\ infrastructure, allowing for more accurate integration with ASP.NET Core routing and API versioning. The settings class exposes configuration options such as \DocumentName\, \ApiGroupNames\ for filtering API versions, and \UseRouteNameAsOperationId\ to control operation ID generation. This component serves as the core engine for ASP.NET Core-specific OpenAPI document generation within the NSwag library.

src/NSwag.Generation.AspNetCore · high confidence

New C\# code generator settings UI in NSwagStudio

The NSwagStudio desktop application now includes a dedicated settings view for the C\# code generator. This new interface exposes configuration options for DTO class generation (including nullable reference types and optional properties), serialization behavior (such as JSON library selection and polymorphic styles), and primitive type mappings, allowing users to fine-tune the generated C\# code directly from the UI.

src/NSwagStudio/Views/CodeGenerators/Views · high confidence

New CLI commands and settings for code generation

The CLI now exposes a comprehensive set of new command-line arguments and configuration options for the code generation commands (jsonschema2csclient, openapi2csclient, openapi2cscontroller, openapi2tsclient). Users can now control C\# client generation modes (e.g., SingleClientFromOperationId, MultipleClientsFromPathSegments), suppress output for client classes/interfaces, configure base classes/interfaces, and manage access modifiers. C\# controller generation supports new options like CancellationToken, ActionResult type, and BasePath override. TypeScript generation adds support for Angular withCredentials, Singleton Provider, and various date/time libraries (DayJS, Luxon, etc.). JSON Schema to C\# generation now includes options for native records, System.Text.Json support, and polymorphic serialization styles.

src/NSwag.Commands/Commands/CodeGeneration · high confidence

New FromDocumentCommand for loading Swagger specs from JSON or URL

A new command-line command, FromDocumentCommand, has been added to the NSwag generation commands. This command allows users to load a Swagger/OpenAPI specification directly from a JSON string or a URL, providing a flexible way to process API definitions without requiring a file path. It integrates with the existing command-line processor and console host to output the processed document.

src/NSwag.Commands/Commands/Generation · high confidence

New SingleOrNew collection extension method

A new internal extension method, SingleOrNew, has been added to the NSwag.Generation.Collections namespace. This utility allows code to retrieve the single element from a collection matching a specific condition, or automatically create a new instance and add it to the collection if no such element exists, simplifying logic that requires ensuring a unique item is present.

src/NSwag.Generation/Collections · high confidence

New UI value converters for visibility, numeric addition, and string arrays

Added three new WPF value converters to the NSwagStudio UI layer: IsValueToVisibilityConverter for binding object equality to UI visibility states, NumberAdditionConverter for performing arithmetic addition in XAML bindings, and StringArrayConverter for serializing and deserializing string collections with configurable separators.

src/NSwagStudio/Converters · high confidence

New UI views for ASP.NET Core, JSON Schema, and OpenAPI/Swagger input generators

NSwagStudio now includes dedicated UI views for three specific swagger generator inputs. The ASP.NET Core generator view allows users to configure project file paths, MSBuild settings (configuration, runtime, target framework), environment variables, and custom document/operation processors. The JSON Schema input view provides a text editor for entering JSON Schema definitions directly. The OpenAPI/Swagger Specification view enables users to load specifications via URL or by pasting JSON/YAML content directly into the editor.

src/NSwagStudio/Views/SwaggerGenerators · high confidence

New YAML serialization and deserialization API for OpenAPI documents

The \src/NSwag.Core.Yaml\ package now provides the \OpenApiYamlDocument\ static class, enabling users to load and save OpenAPI specifications directly from YAML. This includes new \FromYamlAsync\ overloads that accept both string data and \TextReader\ streams, along with \ToYaml\ for converting documents back to YAML format, \FromFileAsync\ for loading from local paths, and \FromUrlAsync\ for fetching from remote URLs.

src/NSwag.Core.Yaml · high confidence

New extensible processor architecture and enhanced API metadata generation

The document generation pipeline has been refactored to introduce a new extensible processor architecture, adding \IDocumentProcessor\ and \IOperationProcessor\ interfaces alongside \ActionDocumentProcessor\ and \OperationProcessor\ wrappers to allow custom logic via delegates. This location specifically implements new processors that enhance the generated OpenAPI metadata: \ApiVersionProcessor\ now supports filtering and replacing API version placeholders in routes, \DocumentTagsProcessor\ and \OperationTagsProcessor\ handle \SwaggerTag\ attributes on controllers and methods (including using controller summaries as tag descriptions), and \OperationSummaryAndDescriptionProcessor\ ensures operation summaries and descriptions are correctly populated from attributes and XML documentation.

src/NSwag.Generation/Processors · high confidence

New security scope processors for OAuth2 operations and definitions

This change introduces two new components in the NSwag generation pipeline: OperationSecurityScopeProcessor and SecurityDefinitionAppender. The OperationSecurityScopeProcessor automatically detects AuthorizeAttribute attributes on methods and types to generate specific OAuth2 security scopes for individual API operations. The SecurityDefinitionAppender registers the OAuth2 security scheme in the document's security definitions and can optionally apply global security requirements with specified scopes. Together, these processors enable automatic generation of OAuth2 security metadata in the resulting Swagger/OpenAPI specification.

src/NSwag.Generation/Processors/Security · high confidence

OWIN integration now supports Swagger UI-only mode and ReDoc

The NSwag OWIN middleware has been refactored to allow more flexible API documentation setup. The \UseSwaggerUi\ extension method now supports a version that configures the Swagger UI without automatically generating the OpenAPI document, enabling users to serve the UI against an externally provided spec. Additionally, a new \UseSwaggerReDoc\ extension method has been added to integrate the ReDoc documentation interface into the OWIN pipeline.

src/NSwag.AspNet.Owin · high confidence

ReDoc integration with customizable page title, styles, and settings

The ReDoc API documentation view now supports dynamic configuration via placeholders for the page title, custom CSS styles, and custom JavaScript scripts, along with additional ReDoc-specific options. This allows users to tailor the appearance and behavior of the ReDoc interface directly through the NSwag middleware settings.

src/NSwag.AspNetCore/ReDoc · high confidence

Architecture

Refactored C\# code generation models into a new Models namespace

The C\# code generation logic has been reorganized by moving template models and supporting classes into the new \NSwag.CodeGeneration.CSharp.Models\ namespace. This change introduces dedicated model classes for clients (\CSharpClientTemplateModel\), controllers (\CSharpControllerTemplateModel\, \CSharpControllerOperationModel\), and file output (\CSharpFileTemplateModel\), along with enums for controller style, target, and route naming. These models expose configuration settings—such as \UseActionResultType\, \ControllerStyle\, and \GenerateNullableReferenceTypes\—directly to the T4 templates, centralizing the data structure used for generating C\# client and controller code.

src/NSwag.CodeGeneration.CSharp/Models · high confidence

Refactored code generation models into a new Models namespace

The operation, parameter, response, and property template models have been reorganized into the \NSwag.CodeGeneration.Models\ namespace. This refactoring introduces \IOperationModel\ and \OperationModelBase\ to manage operation metadata and response sorting, \ParameterModelBase\ to handle parameter details and type detection, \ResponseModelBase\ to manage response schemas and status codes, and \PropertyModel\ to represent complex property structures. This structural change provides a cleaner separation of concerns for the code generation templates.

src/NSwag.CodeGeneration/Models · high confidence

Behavioural changes

C\# client and controller code generation restructured with new settings and base classes

The C\# code generation logic in NSwag has been refactored into a new class hierarchy: CSharpGeneratorBase serves as the abstract foundation, with CSharpClientGenerator and CSharpControllerGenerator handling client and controller generation respectively. This change introduces dedicated settings classes (CSharpClientGeneratorSettings and CSharpControllerGeneratorSettings) that expose granular control over generated code, including access modifiers for client classes and interfaces, options to suppress client/interface output, and configuration for async vs. partial method generation for request/response processing. Controllers now support a BasePath override, explicit control over cancellation tokens, and target-specific behaviors (e.g., returning FileResult for ASP.NET Core binary responses). These changes allow users to customize the structure, style, and behavior of the generated C\# code more precisely.

src/NSwag.CodeGeneration.CSharp · high confidence

C\# client and controller templates restructured into modular extension points

The C\# code generation templates have been refactored from monolithic files into a modular system of specific extension templates (e.g., \Client.Class.Annotations\, \Client.Class.Constructor\, \Client.Class.Body\, \Client.Class.QueryParameter\, \Controller.liquid\). This change allows users to inject custom logic at precise stages of the generated client and controller code—such as adding class-level attributes, modifying constructors, or customizing parameter serialization—without needing to override entire method implementations. The generated code now includes \\#nullable enable\ support and improved nullability handling throughout the client and controller classes.

src/NSwag.CodeGeneration.CSharp/Templates · high confidence

Improved ASP.NET Core generator assembly loading and version validation

The NSwag.AspNetCore.Launcher now uses a dedicated entry point to load the AspNetCoreToOpenApiGeneratorCommand, ensuring it runs within the application's dependency context. This change introduces explicit version checks for required Microsoft.AspNetCore and NSwag assemblies, preventing failures caused by version conflicts, and improves assembly resolution by searching in the tools directory, the launcher's base directory, and a 'Publish' subdirectory.

src/NSwag.AspNetCore.Launcher · high confidence

Introduce dedicated middlewares for OpenAPI document, Swagger UI index, and redirection

The NSwag middleware pipeline now uses three distinct components: OpenApiDocumentMiddleware generates the OpenAPI specification (supporting both JSON and YAML output formats) with caching and error handling; SwaggerUiIndexMiddleware serves the Swagger UI HTML page by reading it from embedded resources and applying HTML transformation; and RedirectToIndexMiddleware handles URL redirection to the UI index, supporting external path transformation for proxy scenarios. This replaces the previous monolithic middleware approach with specialized handlers for each concern.

src/NSwag.AspNetCore/Middlewares · high confidence

Migrate build and CI pipeline to NUKE with .NET 10 support

The build system has been replaced with a NUKE-based pipeline (Build.cs, Build.Pack.cs, Build.Publish.cs), introducing a new CI configuration for GitHub Actions (Build.CI.GitHubActions.cs) that runs on Windows, Linux, and macOS. This change adds support for .NET 10, enables deterministic builds in CI, and updates the publishing workflow to push NuGet packages to NuGet.org (on tags) or MyGet (on branches), alongside Chocolatey and NPM artifacts. The pipeline also configures GNU tar and long-path support on Windows runners.

build · high confidence

NSwag NPM CLI now supports .NET 8, 9, and 10 with config-based runtime detection

The NSwag NPM CLI script has been updated to support .NET 8.0, 9.0, and 10.0 runtimes, replacing older .NET Core versions. Users can now specify the runtime via the \--core\ argument (e.g., \--core 8.0\, \--core 9.0\, \--core 10.0\) or by setting the \runtime\ property in a configuration JSON file, which the CLI will automatically detect and use. The script also handles legacy \--x86\ flags and validates that the specified or detected runtime is supported, exiting with an error if an unsupported version is requested.

src/NSwag.Npm/bin · high confidence

NSwag console tool now uses async command processing

The NSwag command-line interface has been updated to use asynchronous processing for command execution via the new NSwagCommandProcessor. This change improves responsiveness and aligns the console tool with modern .NET practices, specifically targeting .NET 4.6.2+ runtimes as indicated by the runtime check in the entry point.

src/NSwag.Console · high confidence

NSwag.ApiDescription.Client now defaults to NSwagCSharp and supports .NET 8/9/10

The NSwag.ApiDescription.Client package has been updated to make the NSwag C\# generator the default for OpenApiReference and OpenApiProjectReference items, replacing the previous default behavior. The build targets now explicitly support .NET 8, .NET 9, and .NET 10 by invoking the appropriate \dotnet-nswag.dll\ with roll-forward options. Additionally, the package now depends on \Microsoft.Extensions.ApiDescription.Client\ version 8.0.14, aligning with the Microsoft API description client infrastructure.

src/NSwag.ApiDescription.Client · high confidence

NSwag.CodeGeneration refactored into new base classes with enhanced output control and name sanitization

The NSwag.CodeGeneration library has been restructured around new base classes (ClientGeneratorBase, ClientGeneratorBaseSettings) that introduce finer control over code generation. Users can now selectively output only contracts or implementation code via the new ClientGeneratorOutputType enum, and suppress the generation of client classes or interfaces entirely using new settings. Operation and parameter names are now sanitized by replacing dots and other special characters with underscores, and operation names no longer include the 'Async' suffix. Additionally, the template factory now supports Liquid templates and respects the NSWAG\_NOVERSION environment variable to suppress version strings in generated output.

src/NSwag.CodeGeneration · high confidence

NSwagStudio UI restructured with new ViewModel architecture and multi-document support

The NSwagStudio desktop application has been refactored to support multiple open documents and a new code generator selection model. Users can now open multiple .nswag configuration files simultaneously, with the UI preserving tab state via a new caching mechanism. The interface now explicitly supports selecting multiple code generators (TypeScript, C\# Client, C\# Controller) per document, allowing for batch generation. Additionally, the application now includes a JSON Schema input option for Swagger generation and displays an exception box for error handling.

src/NSwagStudio/ViewModels · high confidence

NSwagStudio code generator views are refactored to use a base class and command-based model binding

The UI for code generators in NSwagStudio has been restructured to improve maintainability and consistency. A new abstract base class, CodeGeneratorViewBase, now serves as the foundation for all generator views, standardizing properties like Title, IsSelected, and IsPersistent, as well as the UpdateOutput mechanism. Each specific generator view (CSharp Client, CSharp Controller, TypeScript Client, and the Swagger Output view) now explicitly binds its settings to a corresponding command object (e.g., OpenApiToCSharpClientCommand) via its ViewModel. This change decouples the UI from direct generator instances, allowing for more flexible configuration management and easier extension of new generator types.

src/NSwagStudio/Views/CodeGenerators · high confidence

NSwagStudio installer rebuilt with WiX v6

The Windows installer for NSwagStudio has been migrated to WiX Toolset v6 (SDK 6.0.1). This change updates the underlying build infrastructure for the MSI package, ensuring compatibility with modern WiX standards and resolving previous build warnings, while maintaining the same installation behavior (start menu shortcuts, file associations, and PATH updates).

src/NSwagStudio.Installer · high confidence

New AspNetCore operation processors for security scopes, tags, parameters, and responses

The AspNetCore generation pipeline now includes dedicated processors that refine the generated OpenAPI specification. The new AspNetCoreOperationSecurityScopeProcessor automatically maps ASP.NET Core Authorize attributes to OAuth2 security scopes in the output. AspNetCoreOperationTagsProcessor enhances tag handling by supporting the .NET 6 TagsAttribute and allowing controller summary XML documentation to populate tag descriptions. OperationParameterProcessor improves parameter generation by correctly handling form data for OpenAPI 3, enforcing non-nullable types for required path parameters, and fixing binary parameter support. OperationResponseProcessor updates response generation to better reflect nullability settings and correctly handles void responses.

src/NSwag.Generation.AspNetCore/Processors · high confidence

New WebApi operation processors for consumes, parameters, and responses

The WebApi generation pipeline now includes three new processor components in the \Processors\ directory: \OperationConsumesProcessor\ reads the \ConsumesAttribute\ from action methods or controllers to populate the OpenAPI consumes clause; \OperationParameterProcessor\ handles the mapping of action parameters to OpenAPI parameters, supporting attributes like \FromRoute\, \FromHeader\, \FromForm\, and \FromBody\ while correctly distinguishing between path, header, form, and body parameters; and \OperationResponseProcessor\ generates response definitions by processing \ResponseTypeAttribute\, \SwaggerResponseAttribute\, \ProducesResponseTypeAttribute\, and \ProducesAttribute\, with specific logic to return HTTP 200 for void responses in ASP.NET Core (previously 204).

src/NSwag.Generation.WebApi/Processors · high confidence

New middleware and service extension methods for OpenAPI document and UI integration

The NSwag.AspNetCore extension methods have been restructured to provide dedicated middleware and service registration APIs. The new \UseOpenApi()\ middleware in the application pipeline automatically detects and registers routes for multiple OpenAPI documents when the path contains a \{documentName}\ placeholder, simplifying multi-document setups. Service registration is now handled via \AddOpenApiDocument()\ for OpenAPI 3.0 and \AddSwaggerDocument()\ for Swagger 2.0, which automatically detect and apply the correct JSON serializer settings (System.Text.Json or Newtonsoft.Json) from the application's MVC options. Additionally, the library now includes \UseApimundo()\ to facilitate direct uploads of API specifications to the Apimundo platform, and \AddSecurity()\ extensions to easily append OAuth2 security schemes to the generated document.

src/NSwag.AspNetCore/Extensions · high confidence

Newline behavior control and optimized file output for Swagger/YAML commands

Command-line tools for generating Swagger and YAML documents now support explicit control over line endings via a new \NewLineBehavior\ argument (Auto, CRLF, or LF), allowing users to enforce specific formatting regardless of the host OS. Additionally, the output process has been optimized to write files only when the generated content actually differs from the existing file, preventing unnecessary timestamp updates and reducing disk I/O when regeneration produces identical results.

src/NSwag.Commands/Commands · high confidence

ReDoc integration with customizable styling and settings

The ReDoc UI page for NSwag.AspNet.Owin has been updated to support custom styling and additional configuration options. Users can now inject custom CSS via the {CustomStyle} placeholder and custom JavaScript via the {CustomScript} placeholder, while also passing specific ReDoc configuration parameters through the {AdditionalSettings} placeholder, allowing for greater flexibility in how the API documentation is presented.

src/NSwag.AspNet.Owin/ReDoc · high confidence

Refactored API generation with stricter nullability and new configuration options

The \NSwag.Generation\ library has been restructured to improve type handling and configuration flexibility. The default behavior for \DefaultResponseReferenceTypeNullHandling\ is now set to \NotNull\, meaning generated schemas will treat reference types as non-nullable unless explicitly marked otherwise. The generator now supports unwrapping common generic result types (such as \Task\<T\>\, \ValueTask\<T\>\, \JsonResult\<T\>\, and \ActionResult\<T\>\) to expose the underlying response type in the schema. Additionally, \OpenApiDocumentGeneratorSettings\ now exposes a \SchemaGeneratorFactory\ property, allowing users to provide custom schema generator implementations, and includes new settings to use controller XML summaries as tag descriptions and to utilize the \HttpMethodAttribute\ name for operation IDs.

src/NSwag.Generation · high confidence

Refactored NSwagStudio code generator view models

The view models for the C\# client, C\# controller, and TypeScript client generators have been refactored to expose their underlying command objects and available configuration options directly. This change updates the UI bindings to use the new command-based settings, ensuring that options such as operation modes, class styles, JSON libraries, RxJS versions, and injection token types are correctly populated and synchronized with the generator logic.

src/NSwagStudio/ViewModels/CodeGenerators · high confidence

Refactored OWIN middlewares for Swagger UI and OpenAPI document generation

The OWIN middleware implementation has been refactored to improve path matching and proxy handling. The new OpenApiDocumentMiddleware now generates the Swagger specification with correct host and base path information by respecting the MiddlewareBasePath setting or using the request's server URL. The Swagger UI is now served via dedicated SwaggerUiIndexMiddleware and RedirectToIndexMiddleware components, which handle exact path matching and redirect logic, including support for transforming internal routes to external paths via a configurable delegate. This change ensures more accurate URL generation for the UI and API documentation, especially in proxy scenarios.

src/NSwag.AspNet.Owin/Middlewares · high confidence

Refactored TypeScript client generation into modular Liquid templates

The TypeScript code generation templates have been restructured from monolithic files into a modular system of reusable components. The main client templates (Angular, AngularJS, Axios, Fetch, jQuery) now delegate specific responsibilities to dedicated sub-templates such as \Client.RequestBody\, \Client.RequestUrl\, and a new \Client.ProcessResponse\ hierarchy (including \HandleStatusCode\, \ReadBodyStart/End\, \ReadHeaders\, and \Return\). This refactoring centralizes the logic for building request bodies, constructing URLs with parameter handling, and processing HTTP responses (including file downloads and error handling) across all supported HTTP clients, ensuring consistent behavior and easier maintenance of the generated TypeScript code.

src/NSwag.CodeGeneration.TypeScript/Templates · high confidence

Refactored TypeScript code generation models into framework-specific classes

The TypeScript client generation models have been restructured to improve maintainability and support for multiple JavaScript frameworks. The previous monolithic model has been split into specialized classes: TypeScriptFrameworkModel now handles framework detection (Angular, Aurelia, Fetch, Axios, etc.) and RxJS versioning, while TypeScriptFrameworkAngularModel exposes Angular-specific settings like injection tokens and singleton providers. TypeScriptFileTemplateModel and TypeScriptClientTemplateModel now delegate framework details to these new models, and TypeScriptOperationModel and TypeScriptParameterModel have been updated to support optional parameter ordering and precise type postfixes (null/undefined) for stricter TypeScript modes.

src/NSwag.CodeGeneration.TypeScript/Models · high confidence

Refactored Web API route attribute handling and added environment variable support

The WebApiOpenApiDocumentGenerator now uses new facade classes (RouteAttributeFacade, RoutePrefixAttributeFacade) to uniformly handle route attributes across different .NET implementations, improving compatibility and maintainability. Additionally, the generator now respects the NSWAG\_NOVERSION environment variable to suppress version information in the generated OpenAPI document, and the settings class exposes a configurable DefaultUrlTemplate (defaulting to 'api/{controller}/{id?}') and an IsAspNetCore flag to better tailor generation for ASP.NET Core projects.

src/NSwag.Generation.WebApi · high confidence

Refactored operation name generators with new interface and conflict resolution

The operation name generation logic in NSwag has been refactored to use a new \IOperationNameGenerator\ interface, making the generator methods virtual to allow for easier customization. Several existing generators have been updated to implement this interface and now include improved conflict resolution: if multiple operations share the same generated name, the HTTP method is appended to ensure uniqueness. New generators have been added, including \MultipleClientsFromFirstTagAndOperationIdGenerator\, \MultipleClientsFromFirstTagAndOperationNameGenerator\, and \MultipleClientsFromFirstTagAndPathSegmentsOperationNameGenerator\, providing more flexible ways to structure client classes based on tags, operation IDs, or path segments.

src/NSwag.CodeGeneration/OperationNameGenerators · high confidence

Renamed and expanded annotation attributes for OpenAPI specification generation

The NSwag.Annotations library has introduced a suite of new attributes with 'OpenApi' prefixes (OpenApiOperation, OpenApiController, OpenApiBodyParameter, OpenApiFile, OpenApiIgnore, OpenApiTag, OpenApiTags, OpenApiExtensionData, OpenApiOperationProcessor) to replace the legacy 'Swagger' prefixed attributes, which are now marked obsolete. This change also includes new attributes for specifying HTTP response types (SwaggerResponseAttribute, SwaggerDefaultResponseAttribute) and body consumption behavior (WillReadBodyAttribute). For users, this means updating attribute references in their code to the new naming convention to avoid compiler warnings and ensure compatibility with the latest OpenAPI generation logic, while retaining the ability to specify operation summaries, descriptions, controller names, file handling, and response details.

src/NSwag.Annotations · high confidence

Swagger UI assets updated to v5.21.0 with OAuth2 and custom styling support

The embedded Swagger UI static assets (HTML, CSS, JavaScript, and OAuth2 redirect page) have been updated to version 5.21.0. This update introduces support for custom CSS and JavaScript injection via the \{CustomStyle}\, \{CustomHeadContent}\, and \{CustomScript}\ placeholders in the index template. It also enhances the OAuth2 authentication flow by allowing the client secret to be passed when \usePkceWithAuthorizationCodeGrant\ is enabled, and ensures that empty link and script tags are prevented when custom styles or scripts are not specified.

src/NSwag.AspNetCore/SwaggerUi · high confidence

TypeScript client generator refactoring and new configuration options

The TypeScript code generator has been restructured with new settings and enums to improve flexibility and modernize generated code. Users can now choose between the legacy Angular Http class and the modern HttpClient via the HttpClass setting, and select between OpaqueToken and InjectionToken for Angular dependency injection. New RequestCredentialsType and RequestModeType settings allow fine-grained control over fetch request credentials and CORS modes. The generator now supports AbortSignal for cancellation in Fetch, Aurelia, and Axios templates, and includes a new K6 template for load testing. Additionally, type name conflicts with built-in JavaScript types like 'Date' and 'Error' are resolved by appending 'Dto' (e.g., DateDto), and the PromiseType setting allows choosing between standard Promises and the Q library.

src/NSwag.CodeGeneration.TypeScript · high confidence

Fixes

Inline NConsole library with command-line parsing fixes

The NConsole command-line parsing library has been inlined into the NSwag.Commands project (src/NSwag.Commands/NConsole) and updated with fixes. This change introduces the core command-line processing components, including the CommandLineProcessor for handling command registration and execution, ArgumentAttribute and SwitchAttribute for defining command parameters, and ConsoleHost for managing interactive input and output. The inlining allows NSwag to maintain direct control over the command-line parsing behavior and apply necessary corrections to argument handling and command execution.

src/NSwag.Commands/NConsole · high confidence

Test coverage

Added inheritance test controllers for API schema generation; Added integration test for assembly binding redirect handling; Added parameter handling test controllers; Added response handling test controllers; Added serialization and reference-resolution tests for NSwag.Core; Added test coverage for ASP.NET Core API generation; Added tests for ASP.NET Core API parameter generation; Added tests for ASP.NET Core response generation behavior; Added tests for C\# controller generation with BasePath and default parameters; Added tests for OpenAPI 3 array parameter serialization; Added tests for Web API operation processors; Added tests for Web API parameter and response nullability handling; Added tests for YAML path item description and custom property serialization; Added tests for YAML schema reference resolution; Added tests for operation summary, description, and tag processing; Added tests for request body consumption and content-type handling; Added unit tests for NSwag.Core document loading and reference resolution; Added unit tests for OperationResponseProcessor; Added unit tests for Web API OpenAPI document generation; Added unit tests for WebApi attribute processing; Added unit tests for code generation name resolution and snapshot verification; Expanded TypeScript client generation test coverage; Expanded test coverage for C\# code generation; New test controllers for request body and content-type handling; Updated snapshot tests for .NET 8, 9, and 10 client generation.

Dependencies

Adopts Central Package Management and updates core dependencies

The project now uses Central Package Management (Directory.Packages.props) to define and pin versions for all NuGet packages, ensuring consistent dependency resolution across the solution. Key library updates include NJsonSchema and its code generation packages to version 11.6.1, Namotion.Reflection to 3.5.0, and the test framework to xUnit v3 (3.0.0) with Verify.XunitV3 (30.5.0). The build system has been upgraded to NUKE 10.1.0, and the solution now targets .NET 10.0 in addition to .NET 8.0 and 9.0, with corresponding Microsoft.AspNetCore.\* packages updated to their latest versions for each target framework.

(dependencies) · high confidence

Updated Swagger UI to v5.21.0

The embedded Swagger UI has been upgraded to version 5.21.0. This update brings the latest improvements and bug fixes from the Swagger UI project to the Owin middleware's static distribution bundle, ensuring a modern and stable API documentation experience for users.

src/NSwag.AspNet.Owin/SwaggerUi · high confidence

Housekeeping

Added solution filter and configuration files for the src directory

The \src\ directory now includes \NSwag.NoInstaller.slnf\, a solution filter that defines a specific subset of projects (such as core libraries, code generators, and .NET 8/9/10 samples) to open in Visual Studio, alongside \NSwag.sln\, the main solution file. Additionally, \NuGet.Config\ is added to configure local package sources, \switcher.json\ is introduced to map local NJsonSchema dependencies for development, and \UpgradeLog.htm\ is included as a migration artifact.

src · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 52 → 49 (-2.6)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 59 → 58 (-0.5)
  • Architecture 98 → 98 (+0.2)
  • Maturity 67 → 68 (+1.7)
  • Readiness 54 → 50 (-3.6)
  • Security 45 → 40 (-5.2)
  • Accessibility 57 → 60 (+2.7)

Resolved (56)

  • BarePragmaDisable (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • BarePragmaDisable (src/NSwag.CodeGeneration.CSharp.Tests/OptionalParameterTests.cs)
  • BarePragmaDisable (src/NSwag.CodeGeneration.CSharp.Tests/OptionalParameterTests.cs)
  • Bounded contexts not declared
  • Build did not complete in the analyzer
  • Change coupling: DocumentViewModel.cs ↔ SwaggerOutputView.xaml.cs (src/NSwagStudio/ViewModels/DocumentViewModel.cs)
  • Change coupling: DocumentViewModel.cs ↔ SwaggerToCSharpClientGeneratorView.xaml.cs (src/NSwagStudio/ViewModels/DocumentViewModel.cs)
  • Change coupling: DocumentViewModel.cs ↔ SwaggerToCSharpControllerGeneratorView.xaml.cs (src/NSwagStudio/ViewModels/DocumentViewModel.cs)
  • Change coupling: DocumentViewModel.cs ↔ SwaggerToTypeScriptClientGeneratorView.xaml.cs (src/NSwagStudio/ViewModels/DocumentViewModel.cs)
  • Change coupling: SwaggerOutputView.xaml.cs ↔ SwaggerToCSharpClientGeneratorView.xaml.cs (src/NSwagStudio/Views/CodeGenerators/SwaggerOutputView.xaml.cs)
  • Change coupling: SwaggerToCSharpClientGeneratorView.xaml.cs ↔ SwaggerToCSharpControllerGeneratorView.xaml.cs (src/NSwagStudio/Views/CodeGenerators/SwaggerToCSharpClientGeneratorView.xaml.cs)
  • Change coupling: SwaggerToCSharpClientGeneratorView.xaml.cs ↔ SwaggerToTypeScriptClientGeneratorView.xaml.cs (src/NSwagStudio/Views/CodeGenerators/SwaggerToCSharpClientGeneratorView.xaml.cs)
  • Change coupling: SwaggerToCSharpClientGeneratorViewModel.cs ↔ SwaggerToTypeScriptClientGeneratorView.xaml.cs (src/NSwagStudio/ViewModels/CodeGenerators/SwaggerToCSharpClientGeneratorViewModel.cs)
  • Change coupling: SwaggerToCSharpControllerGeneratorView.xaml.cs ↔ SwaggerToTypeScriptClientGeneratorView.xaml.cs (src/NSwagStudio/Views/CodeGenerators/SwaggerToCSharpControllerGeneratorView.xaml.cs)
  • Change coupling: SwaggerToTypeScriptClientGeneratorViewModel.cs ↔ SwaggerToCSharpClientGeneratorView.xaml.cs (src/NSwagStudio/ViewModels/CodeGenerators/SwaggerToTypeScriptClientGeneratorViewModel.cs)
  • Duplicated block (14 lines × 2) (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • Duplicated block (16 lines × 3) (src/NSwag.Sample.NET80/Startup.cs)
  • Duplicated block (19 lines × 2) (src/NSwag.Sample.NET90/Startup.cs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 36 more

New (90)

  • BarePragmaDisable (src/NSwag.CodeGeneration.CSharp.Tests/OptionalParameterTests.cs)
  • BarePragmaDisable (src/NSwag.CodeGeneration.CSharp.Tests/OptionalParameterTests.cs)
  • Build.Publish.get (cognitive 18) (build/Build.Publish.cs)
  • Depends on a live external host: When_Swagger_is_loaded_from_url_schematype_is_Swagger2 (src/NSwag.Core.Tests/HttpLoadingTests.cs)
  • Depends on a live external host: When_Swagger_is_loaded_from_url_then_it_works (src/NSwag.Core.Tests/HttpLoadingTests.cs)
  • Depends on a live external host: When_openapi_is_loaded_without_scopes_it_should_deserialize (src/NSwag.Core.Tests/HttpLoadingTests.cs)
  • DisabledAnalyzers (src/NSwagStudio/NSwagStudio.csproj)
  • Documentation: no installation or build instructions (README.md)
  • Duplicated block (10 lines × 2) (src/NSwag.AspNet.Owin/SwaggerExtensions.cs)
  • Duplicated block (10 lines × 3) (src/NSwag.Sample.NET100/Program.cs)
  • Duplicated block (16 lines × 2) (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • Duplicated block (17 lines × 2) (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • Duplicated block (17 lines × 3) (src/NSwag.Sample.NET100/Startup.cs)
  • Duplicated block (17–18 lines × 3) (src/NSwag.Sample.NET100/Startup.cs)
  • Duplicated block (20 lines × 2) (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • Duplicated block (23 lines × 2) (src/NSwag.Sample.NET100/Startup.cs)
  • Duplicated block (42 lines × 2) (src/NSwag.Sample.NET80/Controllers/ValuesController.cs)
  • End-of-life runtime: .NET net9.0
  • FileScopedPragmaDisable (src/NSwag.AspNet.WebApi/JsonExceptionFilterAttribute.cs)
  • High secret: WD-SECRET-0001 (src/NSwag.snk)
  • …and 70 more

Changes since last survey

  • 2 commits — 1 feature/other, 1 fixes

By area

  • .github/pull_request_template.md — 1 commit
  • src/NSwag.CodeGeneration.TypeScript.Tests — 1 commit

Notable commits

  • fix: Fix development build dependencies and TypeScript test compiler (#5400)
  • change: docs: add general pull request template (#5401)

API surface

  • Unchanged — 13 HTTP endpoints

Architecture

  • Unchanged — 19 containers · 0 contexts · 0 edges

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

RicoSuter/NSwag was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 23 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 63daf8fcc3a25151b62eb4b326a1e8ea048a0d41 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-955b9cee9818.