From 3e84ec9f011f5418f7c37d9d552310526e47a70f Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sat, 26 Jun 2021 12:49:10 +0300 Subject: [PATCH] NDB.Extensions.Swagger updates --- NDB.Extensions.Swagger/NDB.Extensions.Swagger.csproj | 3 ++- NDB.Extensions.Swagger/SwaggerExtensions.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NDB.Extensions.Swagger/NDB.Extensions.Swagger.csproj b/NDB.Extensions.Swagger/NDB.Extensions.Swagger.csproj index c86e518..46ef9fb 100644 --- a/NDB.Extensions.Swagger/NDB.Extensions.Swagger.csproj +++ b/NDB.Extensions.Swagger/NDB.Extensions.Swagger.csproj @@ -8,11 +8,12 @@ https://dev.azure.com/tstanciu94/NDB Git NDB swagger + 1.0.1 - + diff --git a/NDB.Extensions.Swagger/SwaggerExtensions.cs b/NDB.Extensions.Swagger/SwaggerExtensions.cs index dd4ee3b..3b35ded 100644 --- a/NDB.Extensions.Swagger/SwaggerExtensions.cs +++ b/NDB.Extensions.Swagger/SwaggerExtensions.cs @@ -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 => {