Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle
8.1.7
See the version list below for details.
dotnet add package Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle --version 8.1.7
NuGet\Install-Package Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle -Version 8.1.7
<PackageReference Include="Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle" Version="8.1.7" />
paket add Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle --version 8.1.7
#r "nuget: Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle, 8.1.7"
// Install Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle as a Cake Addin #addin nuget:?package=Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle&version=8.1.7 // Install Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle as a Cake Tool #tool nuget:?package=Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle&version=8.1.7
OpenApi - Swashbuckle
This package provides extensions and filters for OpenAPI (Swagger) with version support using Swashbuckle.
Setup
Nuget package
First, install NuGet. Then, install Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle from the package manager console:
PM> Install-Package Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle
.NET CLI:
First, install .NET CLI. Then, install Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle from the .NET CLI:
dotnet add package Encamina.Enmarcha.AspNet.OpenApi.Swashbuckle
How to use
IServiceCollectionExtensions
IServiceCollectionExtensions
is a static class that provides extension methods for IServiceCollection
to add and configure services for OpenAPI (Swagger) with version support.
Usage
You can use the methods in this class as follows:
IServiceCollection services = new ServiceCollection();
IConfiguration configuration = new ConfigurationBuilder().Build();
services.AddVersionSwaggerGenConfigureOptions(configuration);
IServiceCollection services = new ServiceCollection();
Action<VersionSwaggerGenOptions> options = opts =>
{
opts.Title = "CUSTOM REST API"; // Title for the OpenAPI document when using version support.
};
services.AddVersionSwaggerGenConfigureOptions(options);
Methods
AddVersionSwaggerGenConfigureOptions(this IServiceCollection services, IConfiguration configuration)
: Adds version support for the generation of OpenAPI documents using configuration parameters from the current set of key-value application configuration. It returns theIServiceCollection
for chaining additional calls.AddVersionSwaggerGenConfigureOptions(this IServiceCollection services, Action<VersionSwaggerGenOptions> options)
: Adds version support for the generation of OpenAPI documents using an action to configure option parameters. It returns theIServiceCollection
for chaining additional calls.AddVersionSwaggerGenConfigureOptions(this IServiceCollection services)
: Adds version support for the generation of OpenAPI documents. It returns theIServiceCollection
for chaining additional calls.
Filters
ApiKeyHeaderOperationFilter
ApiKeyHeaderOperationFilter
is a class that implements the IOperationFilter
interface. It's used to add an API key header to the OpenAPI (Swagger) documentation.
Usage
To use this class, you need to create an instance and pass it to the Swagger configuration:
services.AddSwaggerGen(c =>
{
c.OperationFilter<ApiKeyHeaderOperationFilter>("YourHeaderApiKey", "YourDescription");
});
Constructor
ApiKeyHeaderOperationFilter(string headerApiKey)
: Initializes a new instance of the class with the given header API key name and a default description.ApiKeyHeaderOperationFilter(string headerApiKey, string description)
: Initializes a new instance of the class with the given header API key name and description.
Methods
Apply(OpenApiOperation operation, OperationFilterContext context)
: Applies the operation filter to the OpenAPI operation. It adds a newOpenApiParameter
to the operation's parameters, representing the API key header.
DefaultValuesOperationFilter
This C# code defines a class DefaultValuesOperationFilter that implements the IOperationFilter interface. This class is used to enrich the generated OpenAPI (Swagger) documents with default values for parameters.
DefaultValuesOperationFilter
is a class that implements the IOperationFilter
interface. It's used to enrich the generated OpenAPI (Swagger) documents with default values for parameters.
Usage
To use this class, you need to create an instance and pass it to the Swagger configuration:
services.AddSwaggerGen(c =>
{
c.OperationFilter<DefaultValuesOperationFilter>();
});
Methods
Apply(OpenApiOperation operation, OperationFilterContext context)
: Applies the operation filter to the OpenAPI operation. It adds default values to the operation's parameters and removes unsupported content types from the operation's responses.
VersionSwaggerGenConfigureOptions
This C# code defines a class VersionSwaggerGenConfigureOptions that implements the IConfigureOptions<SwaggerGenOptions> interface. This class is used to configure Swagger generation options for versioned OpenAPI documents.
VersionSwaggerGenConfigureOptions
is a class that implements the IConfigureOptions<SwaggerGenOptions>
interface. It's used to configure Swagger generation options for versioned OpenAPI documents.
Usage
To use this class, you need to create an instance and pass it to the Swagger configuration:
services.AddSwaggerGen(c =>
{
c.Configure<VersionSwaggerGenConfigureOptions>();
});
Constructor
VersionSwaggerGenConfigureOptions(IApiVersionDescriptionProvider apiVersionDescriptionProvider, IOptions<VersionSwaggerGenOptions> options)
: Initializes a new instance of the class with the given API version description provider and configuration options.
Methods
Configure(SwaggerGenOptions options)
: Configures the Swagger generation options. It adds a newOpenApiInfo
to the Swagger documentation for each API version.
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. |
-
net8.0
- Asp.Versioning.Mvc.ApiExplorer (>= 8.1.0)
- CommunityToolkit.Diagnostics (>= 8.2.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
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 |
---|---|---|
8.2.0 | 450 | 10/22/2024 |
8.2.0-preview-01-m01 | 105 | 9/17/2024 |
8.1.9-preview-03 | 60 | 11/19/2024 |
8.1.9-preview-02 | 61 | 10/22/2024 |
8.1.9-preview-01 | 317 | 10/4/2024 |
8.1.8 | 742 | 9/23/2024 |
8.1.8-preview-07 | 205 | 9/12/2024 |
8.1.8-preview-06 | 255 | 9/11/2024 |
8.1.8-preview-05 | 87 | 9/10/2024 |
8.1.8-preview-04 | 429 | 8/16/2024 |
8.1.8-preview-03 | 179 | 8/13/2024 |
8.1.8-preview-02 | 109 | 8/13/2024 |
8.1.8-preview-01 | 112 | 8/12/2024 |
8.1.7 | 103 | 8/7/2024 |
8.1.7-preview-09 | 192 | 7/3/2024 |
8.1.7-preview-08 | 84 | 7/2/2024 |
8.1.7-preview-07 | 84 | 6/10/2024 |
8.1.7-preview-06 | 78 | 6/10/2024 |
8.1.7-preview-05 | 86 | 6/6/2024 |
8.1.7-preview-04 | 95 | 6/6/2024 |
8.1.7-preview-03 | 89 | 5/24/2024 |
8.1.7-preview-02 | 84 | 5/10/2024 |
8.1.7-preview-01 | 95 | 5/8/2024 |
8.1.6 | 1,167 | 5/7/2024 |
8.1.6-preview-08 | 61 | 5/2/2024 |
8.1.6-preview-07 | 85 | 4/29/2024 |
8.1.6-preview-06 | 567 | 4/26/2024 |
8.1.6-preview-05 | 102 | 4/24/2024 |
8.1.6-preview-04 | 120 | 4/22/2024 |
8.1.6-preview-03 | 89 | 4/22/2024 |
8.1.6-preview-02 | 158 | 4/17/2024 |
8.1.6-preview-01 | 182 | 4/15/2024 |
8.1.5 | 114 | 4/15/2024 |
8.1.5-preview-15 | 101 | 4/10/2024 |
8.1.5-preview-14 | 96 | 3/20/2024 |
8.1.5-preview-13 | 79 | 3/18/2024 |
8.1.5-preview-12 | 102 | 3/13/2024 |
8.1.5-preview-11 | 88 | 3/13/2024 |
8.1.5-preview-10 | 99 | 3/13/2024 |
8.1.5-preview-09 | 96 | 3/12/2024 |
8.1.5-preview-08 | 79 | 3/12/2024 |
8.1.5-preview-07 | 93 | 3/8/2024 |
8.1.5-preview-06 | 344 | 3/8/2024 |
8.1.5-preview-05 | 85 | 3/7/2024 |
8.1.5-preview-04 | 74 | 3/7/2024 |
8.1.5-preview-03 | 82 | 3/7/2024 |
8.1.5-preview-02 | 201 | 2/28/2024 |
8.1.5-preview-01 | 172 | 2/19/2024 |
8.1.4 | 278 | 2/15/2024 |
8.1.3 | 112 | 2/13/2024 |
8.1.3-preview-07 | 84 | 2/13/2024 |
8.1.3-preview-06 | 112 | 2/12/2024 |
8.1.3-preview-05 | 102 | 2/9/2024 |
8.1.3-preview-04 | 102 | 2/8/2024 |
8.1.3-preview-03 | 106 | 2/7/2024 |
8.1.3-preview-02 | 81 | 2/2/2024 |
8.1.3-preview-01 | 83 | 2/2/2024 |
8.1.2 | 127 | 2/1/2024 |
8.1.2-preview-9 | 91 | 1/22/2024 |
8.1.2-preview-8 | 81 | 1/19/2024 |
8.1.2-preview-7 | 82 | 1/19/2024 |
8.1.2-preview-6 | 79 | 1/19/2024 |
8.1.2-preview-5 | 84 | 1/19/2024 |
8.1.2-preview-4 | 89 | 1/19/2024 |
8.1.2-preview-3 | 84 | 1/18/2024 |
8.1.2-preview-2 | 85 | 1/18/2024 |
8.1.2-preview-16 | 86 | 1/31/2024 |
8.1.2-preview-15 | 74 | 1/31/2024 |
8.1.2-preview-14 | 90 | 1/25/2024 |
8.1.2-preview-13 | 92 | 1/25/2024 |
8.1.2-preview-12 | 95 | 1/23/2024 |
8.1.2-preview-11 | 84 | 1/23/2024 |
8.1.2-preview-10 | 85 | 1/22/2024 |
8.1.2-preview-1 | 87 | 1/18/2024 |
8.1.1 | 123 | 1/18/2024 |
8.1.0 | 100 | 1/18/2024 |
8.0.3 | 162 | 12/29/2023 |
8.0.1 | 158 | 12/14/2023 |
8.0.0 | 151 | 12/7/2023 |
6.0.4.3 | 115 | 12/29/2023 |
6.0.4.2 | 125 | 12/20/2023 |
6.0.4.1 | 189 | 12/19/2023 |
6.0.4 | 162 | 12/4/2023 |
6.0.3.20 | 138 | 11/27/2023 |
6.0.3.19 | 125 | 11/22/2023 |