![]() |
VOOZH | about |
dotnet add package AzureExtensions.Swashbuckle --version 5.0.5
NuGet\Install-Package AzureExtensions.Swashbuckle -Version 5.0.5
<PackageReference Include="AzureExtensions.Swashbuckle" Version="5.0.5" />
<PackageVersion Include="AzureExtensions.Swashbuckle" Version="5.0.5" />Directory.Packages.props
<PackageReference Include="AzureExtensions.Swashbuckle" />Project file
paket add AzureExtensions.Swashbuckle --version 5.0.5
#r "nuget: AzureExtensions.Swashbuckle, 5.0.5"
#:package AzureExtensions.Swashbuckle@5.0.5
#addin nuget:?package=AzureExtensions.Swashbuckle&version=5.0.5Install as a Cake Addin
#tool nuget:?package=AzureExtensions.Swashbuckle&version=5.0.5Install as a Cake Tool
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">
π CI
π Auto-Release
π NuGet
π NuGet Downloads
π License: MIT
</p>
<p align="center">
π .NET 8
π .NET 9
π Swashbuckle 10
π Swagger UI
π OpenAPI
π Azure Functions
π Tests
</p>
ConfigureFunctionsWebApplication compatibility β removed AddMvcCore() which registered the full MVC routing pipeline, conflicting with Azure Functions HTTP routing and causing requests to hangfunc startIActionResult-based extension methods for ConfigureFunctionsWebApplication
CreateSwaggerJsonDocumentResult, CreateSwaggerYamlDocumentResult, CreateSwaggerUIResult, CreateSwaggerOAuth2RedirectResultContentResult β no HttpResponseData pipeline issuesSwaggerValidate self-test endpoint in TestFunction0x80008096) caused by missing MVC core service registrationsFakeHttpRequestData, FakeHttpResponseData) for extension method testingHttpResponseData extension + 16 IActionResult extension + 14 DI functional (191 total)FunctionContext incorrectly treated as body parameter (#122)IDisposable to SwashbuckleConfig for proper cleanup[QueryStringParameter], [RequestHttpHeader], [SwaggerUploadFile], [RequestBodyType]dotnet add package AzureExtensions.Swashbuckle
Program.csusing AzureFunctions.Extensions.Swashbuckle;
using AzureFunctions.Extensions.Swashbuckle.Settings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi;
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.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();
Note:
AddSwashBuckleis fully compatible withConfigureFunctionsWebApplication(ASP.NET Core integration). It does not registerAddMvcCore()β only the minimal services needed for API description, so it won't interfere with Azure Functions HTTP routing.
Recommended β use IActionResult with ConfigureFunctionsWebApplication:
public class SwaggerController
{
private readonly ISwashBuckleClient swashBuckleClient;
public SwaggerController(ISwashBuckleClient swashBuckleClient)
{
this.swashBuckleClient = swashBuckleClient;
}
[SwaggerIgnore]
[Function("SwaggerJson")]
public async Task<IActionResult> SwaggerJson(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Swagger/json")]
HttpRequest req)
{
return await this.swashBuckleClient.CreateSwaggerJsonDocumentResult(req);
}
[SwaggerIgnore]
[Function("SwaggerYaml")]
public async Task<IActionResult> SwaggerYaml(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Swagger/yaml")]
HttpRequest req)
{
return await this.swashBuckleClient.CreateSwaggerYamlDocumentResult(req);
}
[SwaggerIgnore]
[Function("SwaggerUi")]
public async Task<IActionResult> SwaggerUi(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Swagger/ui")]
HttpRequest req)
{
return await this.swashBuckleClient.CreateSwaggerUIResult(req, "swagger/json");
}
}
Navigate to https://your-function-app/api/swagger/ui in your browser.
Enable XML doc generation in your .csproj:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Then pass the XML path:
opts.XmlPath = "MyFunctionApp.xml";
opts.Documents = new[]
{
new SwaggerDocument { Name = "v1", Title = "API v1", Version = "v1" },
new SwaggerDocument { Name = "v2", Title = "API v2", Version = "v2" }
};
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";
// 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(...)
services.AddSwashBuckle(opts =>
{
opts.AddNewtonsoftSupport = true;
// ...
});
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 |
// v4.x
Stream json = client.GetSwaggerJsonDocument(req, "v1");
// v5.x
Stream json = await client.GetSwaggerJsonDocumentAsync(req, "v1");
See the TestFunction project for a complete working example.
Contributions are welcome! Please open an issue or submit a pull request.
Copyright Β© 2026, Vitali Bibikov. Code released under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 3 NuGet packages that depend on AzureExtensions.Swashbuckle:
| Package | Downloads |
|---|---|
|
Service.Extensions.Functions
Extensions to provide consistent configurations and patterns for your service. |
|
|
GarageGroup.Infra.Azure.Swagger
Package Description |
|
|
Nebularium.Cthulhu.Swagger
Biblioteca para utilizaΓ§Γ£o em projetos Azure Functions expond uri do swagger. |
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 | 20,563 | 3/9/2026 |
| 5.0.4 | 182 | 3/9/2026 |
| 5.0.3 | 159 | 3/9/2026 |
| 5.0.2 | 159 | 3/9/2026 |
| 5.0.1 | 156 | 3/9/2026 |
| 5.0.0 | 310 | 3/9/2026 |
| 4.0.4 | 481,349 | 8/28/2024 |
| 4.0.3 | 164,699 | 5/24/2024 |
| 4.0.2 | 24,716 | 5/15/2024 |
| 4.0.1 | 16,141 | 5/2/2024 |
| 4.0.0-beta | 308 | 5/1/2024 |
| 3.3.2 | 2,127,796 | 3/24/2021 |
| 3.3.1-beta | 10,011 | 2/2/2021 |
| 3.3.0-beta | 8,599 | 12/8/2020 |
| 3.2.2 | 702,906 | 6/17/2020 |
| 3.2.1-beta | 1,554 | 6/9/2020 |
| 3.2.0-beta | 1,600 | 6/4/2020 |
| 3.1.6 | 92,589 | 5/10/2020 |
| 3.1.5-beta | 1,446 | 5/3/2020 |