Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samhammerag/samhammer.swagger
swagger configurations for .NET Core web projects
https://github.com/samhammerag/samhammer.swagger
net-core-project-lib swagger
Last synced: 23 days ago
JSON representation
swagger configurations for .NET Core web projects
- Host: GitHub
- URL: https://github.com/samhammerag/samhammer.swagger
- Owner: SamhammerAG
- Created: 2020-03-09T14:26:45.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-08T12:55:50.000Z (10 months ago)
- Last Synced: 2024-11-30T04:42:44.483Z (23 days ago)
- Topics: net-core-project-lib, swagger
- Language: C#
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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:
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen();
services.AddSwaggerDefaultApi();
}public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI();
}
```#### Remove package & change to default configuration:
```csharp
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
```csharp
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:
```js
"SwaggerAuthOptions": {
"ClientId": "<>",
"AccessTokenUrl": "<>",
"AuthUrl": "<>"
},
```### Guest Authentication
For Authenticaton by https://github.com/SamhammerAG/Samhammer.Authentication#guest-authentication```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGuest(Configuration);
}
```For override of default settings (enabled true) add this to appsettings.json:
```js
"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:
```csharp
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