Samhammer.Swagger.Default
6.0.0
dotnet add package Samhammer.Swagger.Default --version 6.0.0
NuGet\Install-Package Samhammer.Swagger.Default -Version 6.0.0
<PackageReference Include="Samhammer.Swagger.Default" Version="6.0.0" />
paket add Samhammer.Swagger.Default --version 6.0.0
#r "nuget: Samhammer.Swagger.Default, 6.0.0"
// Install Samhammer.Swagger.Default as a Cake Addin
#addin nuget:?package=Samhammer.Swagger.Default&version=6.0.0
// Install Samhammer.Swagger.Default as a Cake Tool
#tool nuget:?package=Samhammer.Swagger.Default&version=6.0.0
Samhammer.Swagger.Default [OBSOLETE]
This providdes configuration for swagger with default endpoints for swagger spec and ui. It can be used in every web API project that is built with ASP.NET Core.
How to add this to your project:
- reference this package to your project: https://www.nuget.org/packages/Samhammer.Swagger.Default/
How to use:
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen();
services.AddSwaggerDefaultApi();
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI();
}
Remove package & change to default configuration:
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen();
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI();
}
Samhammer.Swagger.Authentication
This providdes configuration for swagger with authentication by oauth2 codeflow or bearer token or guest auth. It can be used in every web API project that is built with ASP.NET Core.
How to add this to your project:
- reference this package to your project: https://www.nuget.org/packages/Samhammer.Swagger.Authentication/
How to use:
JWT Authentication
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen();
services.AddSwaggerAuthentication(Configuration);
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI();
}
For setup of auth2 codeflow add this to appsettings.json:
"SwaggerAuthOptions": {
"ClientId": "<<ClientId>>",
"AccessTokenUrl": "<<TokenUrl>>",
"AuthUrl": "<<AuthUrl>>"
},
Guest Authentication
For Authenticaton by https://github.com/SamhammerAG/Samhammer.Authentication#guest-authentication
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGuest(Configuration);
}
For override of default settings (enabled true) add this to appsettings.json:
"SwaggerGuestOptions": {
"Enabled": false
}
Samhammer.Swagger.Versioning
This providdes configuration for swagger with api versioning support. It can be used in every web API project that is built with ASP.NET Core.
How to add this to your project:
- reference this package to your project: https://www.nuget.org/packages/Samhammer.Swagger.Authentication/
How to use:
public void ConfigureServices(IServiceCollection services)
{
services.AddApiVersioning(...);
services.AddSwaggerGen();
services.AddSwaggerVersionedApi();
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI();
}
Contribute
How to publish package
- Create a tag and let the github action do the publishing for you
Product | Versions |
---|---|
.NET | net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
-
net6.0
- Swashbuckle.AspNetCore (>= 6.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.