AzureExtensions.Swashbuckle
5.0.2
See the version list below for details.
dotnet add package AzureExtensions.Swashbuckle --version 5.0.2
NuGet\Install-Package AzureExtensions.Swashbuckle -Version 5.0.2
<PackageReference Include="AzureExtensions.Swashbuckle" Version="5.0.2" />
<PackageVersion Include="AzureExtensions.Swashbuckle" Version="5.0.2" />
<PackageReference Include="AzureExtensions.Swashbuckle" />
paket add AzureExtensions.Swashbuckle --version 5.0.2
#r "nuget: AzureExtensions.Swashbuckle, 5.0.2"
#:package AzureExtensions.Swashbuckle@5.0.2
#addin nuget:?package=AzureExtensions.Swashbuckle&version=5.0.2
#tool nuget:?package=AzureExtensions.Swashbuckle&version=5.0.2
AzureExtensions.Swashbuckle
Swagger and Swagger UI for Azure Functions (isolated worker model) powered by Swashbuckle. Supports OpenAPI 2.0, 3.0, and 3.1.
<p align="center">
</p>
<p align="center">
</p>
What's New in v5.0.2
- Fixed startup crash (
0x80008096) caused by missing MVC core service registrations - Added 14 functional tests for DI registration validation (150 total)
What's New in v5.0.1
- Updated embedded Swagger UI from v5.11 to v5.32.0
- Fixed resource leaks in response extension methods
- Fixed route parameter regex matching bug
- Fixed
FunctionContextincorrectly treated as body parameter (#122) - Fixed XML documentation file not found in TFM subdirectories (#114)
- Fixed Content-Type header on JSON/YAML responses (#119)
- Added
IDisposabletoSwashbuckleConfigfor proper cleanup - Added 136 unit, integration, and end-to-end tests
Features
- Isolated Worker Model — Built for Azure Functions v4 isolated worker (the recommended model going forward)
- Swashbuckle 10.x — Latest Swashbuckle.AspNetCore with Microsoft.OpenApi v2 support
- OpenAPI 2.0 / 3.0 / 3.1 — Generate specs in any supported version
- Swagger UI — Embedded Swagger UI served directly from your Azure Function
- Multi-document — Define multiple API versions/documents
- XML Comments — Automatic parameter and response documentation from XML docs
- Custom Attributes —
[QueryStringParameter],[RequestHttpHeader],[SwaggerUploadFile],[RequestBodyType] - OAuth2 Support — Built-in OAuth2 redirect endpoint and client configuration
- Newtonsoft.Json — Optional Newtonsoft serialization support
- Multi-targeting — .NET 8.0 (LTS) and .NET 9.0 (STS)
Installation
dotnet add package AzureExtensions.Swashbuckle
Quick Start
1. Register the Extension in Program.cs
using AzureFunctions.Extensions.Swashbuckle;
using AzureFunctions.Extensions.Swashbuckle.Settings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi;
var host = new HostBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddSwashBuckle(opts =>
{
opts.RoutePrefix = "api";
opts.SpecVersion = OpenApiSpecVersion.OpenApi3_0;
opts.AddCodeParameter = true;
opts.PrependOperationWithRoutePrefix = true;
opts.XmlPath = "MyFunctionApp.xml";
opts.Documents = new[]
{
new SwaggerDocument
{
Name = "v1",
Title = "My API",
Description = "My Azure Functions API",
Version = "v1"
}
};
opts.Title = "My API";
});
})
.Build();
host.Run();
2. Add Swagger Endpoints
public class SwaggerController
{
private readonly ISwashBuckleClient swashBuckleClient;
public SwaggerController(ISwashBuckleClient swashBuckleClient)
{
this.swashBuckleClient = swashBuckleClient;
}
[SwaggerIgnore]
[Function("SwaggerJson")]
public async Task<HttpResponseData> SwaggerJson(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "Swagger/json")]
HttpRequestData req)
{
return await this.swashBuckleClient.CreateSwaggerJsonDocumentResponse(req);
}
[SwaggerIgnore]
[Function("SwaggerYaml")]
public async Task<HttpResponseData> SwaggerYaml(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "Swagger/yaml")]
HttpRequestData req)
{
return await this.swashBuckleClient.CreateSwaggerYamlDocumentResponse(req);
}
[SwaggerIgnore]
[Function("SwaggerUi")]
public async Task<HttpResponseData> SwaggerUi(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "Swagger/ui")]
HttpRequestData req)
{
return await this.swashBuckleClient.CreateSwaggerUIResponse(req, "swagger/json");
}
}
3. Open Swagger UI
Navigate to https://your-function-app/api/swagger/ui in your browser.
Configuration Options
XML Documentation
Enable XML doc generation in your .csproj:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Then pass the XML path:
opts.XmlPath = "MyFunctionApp.xml";
Multiple Documents
opts.Documents = new[]
{
new SwaggerDocument { Name = "v1", Title = "API v1", Version = "v1" },
new SwaggerDocument { Name = "v2", Title = "API v2", Version = "v2" }
};
OAuth2
opts.ConfigureSwaggerGen = x =>
{
x.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
Implicit = new OpenApiOAuthFlow
{
AuthorizationUrl = new Uri("https://your.idserver.net/connect/authorize"),
Scopes = new Dictionary<string, string>
{
{ "api.read", "Access read operations" },
{ "api.write", "Access write operations" }
}
}
}
});
};
opts.ClientId = "your.client.id";
opts.OAuth2RedirectPath = "http://localhost:7071/api/swagger/oauth2-redirect";
Custom Attributes
// Add query string parameters
[QueryStringParameter("page", "Page number", DataType = typeof(int), Required = false)]
[Function("GetItems")]
public async Task<HttpResponseData> GetItems(...)
// Add required HTTP headers
[RequestHttpHeader("X-Api-Key", isRequired: true)]
[Function("SecureEndpoint")]
public async Task<HttpResponseData> SecureEndpoint(...)
// File upload
[SwaggerUploadFile("file", "File to upload")]
[Function("Upload")]
public async Task<HttpResponseData> Upload(...)
Newtonsoft.Json Support
services.AddSwashBuckle(opts =>
{
opts.AddNewtonsoftSupport = true;
// ...
});
Migration from v4.x to v5.x
v5.0 includes breaking changes due to the Swashbuckle 10.x / Microsoft.OpenApi v2 upgrade:
| Change | v4.x | v5.x |
|---|---|---|
| Swagger document methods | Synchronous | Async (GetSwaggerJsonDocumentAsync) |
| OpenAPI schema types | Type = "string" |
Type = JsonSchemaType.String |
| Nullable schemas | Nullable = true |
JsonSchemaType.X \| JsonSchemaType.Null |
| OpenAPI namespace | Microsoft.OpenApi.Models |
Microsoft.OpenApi |
Async Document Methods
// v4.x
Stream json = client.GetSwaggerJsonDocument(req, "v1");
// v5.x
Stream json = await client.GetSwaggerJsonDocumentAsync(req, "v1");
Sample Project
See the TestFunction project for a complete working example.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
Copyright © 2026, Vitali Bibikov. Code released under the MIT License.
| Product | Versions 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 was computed. 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. |
-
net8.0
- Swashbuckle.AspNetCore (>= 10.1.4)
- Swashbuckle.AspNetCore.Newtonsoft (>= 10.1.4)
- Swashbuckle.AspNetCore.Swagger (>= 10.1.4)
-
net9.0
- Swashbuckle.AspNetCore (>= 10.1.4)
- Swashbuckle.AspNetCore.Newtonsoft (>= 10.1.4)
- Swashbuckle.AspNetCore.Swagger (>= 10.1.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on AzureExtensions.Swashbuckle:
| Package | Downloads |
|---|---|
|
Service.Extensions.Functions
Extensions to provide consistent configurations and patterns for your service. |
|
|
Nebularium.Cthulhu.Swagger
Biblioteca para utilização em projetos Azure Functions expond uri do swagger. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on AzureExtensions.Swashbuckle:
| Repository | Stars |
|---|---|
|
Azure-Samples/saga-orchestration-serverless
An orchestration-based saga implementation reference in a serverless architecture
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.5 | 885 | 3/9/2026 |
| 5.0.4 | 101 | 3/9/2026 |
| 5.0.3 | 84 | 3/9/2026 |
| 5.0.2 | 90 | 3/9/2026 |
| 5.0.1 | 86 | 3/9/2026 |
| 5.0.0 | 111 | 3/9/2026 |
| 4.0.4 | 390,149 | 8/28/2024 |
| 4.0.3 | 145,598 | 5/24/2024 |
| 4.0.2 | 23,562 | 5/15/2024 |
| 4.0.1 | 15,594 | 5/2/2024 |
| 4.0.0-beta | 284 | 5/1/2024 |
| 3.3.2 | 2,081,019 | 3/24/2021 |
| 3.3.1-beta | 9,974 | 2/2/2021 |
| 3.3.0-beta | 8,540 | 12/8/2020 |
| 3.2.2 | 696,765 | 6/17/2020 |
| 3.2.1-beta | 1,525 | 6/9/2020 |
| 3.2.0-beta | 1,567 | 6/4/2020 |
| 3.1.6 | 92,057 | 5/10/2020 |
| 3.1.5-beta | 1,419 | 5/3/2020 |