NDB.Extensions.Swagger updates

messaging
Tudor Stanciu 2021-06-26 12:49:10 +03:00
parent 552db38f16
commit 3e84ec9f01
2 changed files with 13 additions and 1 deletions

View File

@ -8,11 +8,12 @@
<RepositoryUrl>https://dev.azure.com/tstanciu94/NDB</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageTags>NDB swagger</PackageTags>
<Version>1.0.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NDB.Application.DataContracts" Version="1.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
</Project>

View File

@ -13,6 +13,17 @@ namespace NDB.Extensions.Swagger
public static class SwaggerExtensions
{
public static IServiceCollection AddSwagger(this IServiceCollection services, string title, AuthorizationType authorizationType = AuthorizationType.Basic)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = title, Version = "v1" });
c.SetAuthorization(authorizationType);
});
return services;
}
public static IServiceCollection AddSwaggerWithFilters(this IServiceCollection services, string title, AuthorizationType authorizationType = AuthorizationType.Basic)
{
services.AddSwaggerGen(c =>
{