CSharpEssentials.AspNetCore.Swashbuckle 5.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSharpEssentials.AspNetCore.Swashbuckle --version 5.2.0
                    
NuGet\Install-Package CSharpEssentials.AspNetCore.Swashbuckle -Version 5.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSharpEssentials.AspNetCore.Swashbuckle" Version="5.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials.AspNetCore.Swashbuckle" Version="5.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CSharpEssentials.AspNetCore.Swashbuckle" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CSharpEssentials.AspNetCore.Swashbuckle --version 5.2.0
                    
#r "nuget: CSharpEssentials.AspNetCore.Swashbuckle, 5.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CSharpEssentials.AspNetCore.Swashbuckle@5.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CSharpEssentials.AspNetCore.Swashbuckle&version=5.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CSharpEssentials.AspNetCore.Swashbuckle&version=5.2.0
                    
Install as a Cake Tool

CSharpEssentials.AspNetCore.Swashbuckle

Swashbuckle (Swagger) integration for CSharpEssentials.AspNetCore: versioned Swagger setup, schema ids and security schemes.

One host, one OpenAPI package: reference either CSharpEssentials.AspNetCore.Swashbuckle (Swashbuckle, Microsoft.OpenApi 1.x) or CSharpEssentials.AspNetCore.OpenApi (Microsoft.AspNetCore.OpenApi, Microsoft.OpenApi 2.x), never both.

Installation

dotnet add package CSharpEssentials.AspNetCore.Swashbuckle

Targets net8.0, net9.0, net10.0 and net11.0 with Swashbuckle.AspNetCore 8.1 or later (below 10).

Swagger with Versioning

using CSharpEssentials.AspNetCore; // AddSwagger, DefaultConfigureSwaggerOptions, SecuritySchemes, UseVersionableSwagger

builder.Services.AddSwagger<DefaultConfigureSwaggerOptions>(securityScheme: SecuritySchemes.JwtBearerTokenSecurity);

var app = builder.Build();
app.UseVersionableSwagger();

AddSwagger includes the XML documentation file of every assembly that declares an endpoint (controllers and Minimal API handlers), plus the optional assembly argument. Missing files are skipped.

Enum schemas

using CSharpEssentials.AspNetCore; // AddEnumConventions for IServiceCollection and SwaggerGenOptions

builder.Services.AddEnumConventions();
builder.Services.AddSwaggerGen(o => o.AddEnumConventions()); // AddSwagger calls it

Enums handled by the enum conventions ([StringEnum] or generated metadata) are described the way they are written: one component per enum with the wire names in enum, x-enum-varnames, x-enum-descriptions, x-enum-numeric-values and a value table appended to your description (obsolete members (deprecated), the [EnumFallback] member Response only:). default is the wire name, [Flags] enums are arrays with uniqueItems: true, and nullable is written where the enum is used (allOf + nullable: true, OpenAPI 3.0).

A document whose operations all write numbers describes the enums as integer; a document that mixes formats describes strings and marks each number operation with x-enum-wire-format: number and a note; it also logs one warning per enum used in both formats (once per document). Header selected operations get x-enum-wire-format-header and a note; a selector that throws for a request without the header is described with the global WriteAs format and logged once as a warning. Enums without [StringEnum] or metadata keep the Swashbuckle schema.

The schemas match those of CSharpEssentials.AspNetCore.OpenApi (both are compared with the same golden files).

From 4.x

The Swagger code moved here from CSharpEssentials.AspNetCore; namespaces and the AddSwagger API are unchanged. EnumSchemaFilter now takes an IServiceProvider (Swashbuckle creates it); register it with AddEnumConventions() instead of SchemaFilter<EnumSchemaFilter>().

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.4.0 0 10/9/2026
6.3.0 26 10/8/2026
6.2.0 41 10/8/2026
6.1.0 43 10/7/2026
6.0.0 42 10/7/2026
5.2.1 44 10/7/2026
5.2.0 44 10/7/2026
5.1.0 41 10/7/2026
5.0.0 44 10/6/2026