From c806f86f79461e4e65d64bad1bd9d13f0ddfc29e Mon Sep 17 00:00:00 2001 From: HaikAsatryan Date: Mon, 9 Dec 2024 13:46:06 +0400 Subject: [PATCH] swagger enhancment --- Readme.md | 2 +- Shared.Kernel.Demo/Program.cs | 6 ++---- src/SharedKernel/Extensions/ControllerExtensions.cs | 2 -- .../Extensions/OpenTelemetryExtension.cs | 1 - src/SharedKernel/OpenApi/OpenApiExtensions.cs | 1 - src/SharedKernel/OpenApi/UiExtensions.cs | 5 +---- src/SharedKernel/SharedKernel.csproj | 12 ++++++------ 7 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Readme.md b/Readme.md index 655229c..9dd60b0 100644 --- a/Readme.md +++ b/Readme.md @@ -253,7 +253,7 @@ Add the following configuration to your `appsettings.json` file: Based on the above configuration, the UI will be accessible at the following URLs: - **Swagger (all documents):** [http://localhost/swagger](http://localhost/swagger) -- **Swagger (external document only):** [http://localhost/doc/integration-v1](http://localhost/doc/integration-v1) +- **Swagger (external document only):** [http://localhost/swagger/integration-v1](http://localhost/swagger/integration-v1) - **Scalar (admin document):** [http://localhost/scalar/admin-v1](http://localhost/scalar/admin-v1) - **Scalar (integration document):** [http://localhost/scalar/integration-v1](http://localhost/scalar/integration-v1) diff --git a/Shared.Kernel.Demo/Program.cs b/Shared.Kernel.Demo/Program.cs index 700d9c3..bc5ca2d 100644 --- a/Shared.Kernel.Demo/Program.cs +++ b/Shared.Kernel.Demo/Program.cs @@ -1,10 +1,8 @@ -using DistributedCache.Options; using FluentMinimalApiMapper; using Microsoft.AspNetCore.Mvc; using SharedKernel.Demo2; using ResponseCrafter.Enums; using ResponseCrafter.Extensions; -using ResponseCrafter.HttpExceptions; using SharedKernel.Extensions; using SharedKernel.Helpers; using SharedKernel.Logging; @@ -27,8 +25,8 @@ .AddControllers(AssemblyRegistry.ToArray()) .AddMediatrWithBehaviors(AssemblyRegistry.ToArray()) .AddResilienceDefaultPipeline() - .AddRedis(KeyPrefix.AssemblyNamePrefix) - .AddDistributedSignalR("DistributedSignalR") // or .AddSignalR() + // .AddRedis(KeyPrefix.AssemblyNamePrefix) + //.AddDistributedSignalR("DistributedSignalR") // or .AddSignalR() .MapDefaultTimeZone() .AddCors() .AddHealthChecks(); diff --git a/src/SharedKernel/Extensions/ControllerExtensions.cs b/src/SharedKernel/Extensions/ControllerExtensions.cs index 1303a55..373440d 100644 --- a/src/SharedKernel/Extensions/ControllerExtensions.cs +++ b/src/SharedKernel/Extensions/ControllerExtensions.cs @@ -1,10 +1,8 @@ using System.Reflection; -using System.Text.RegularExpressions; using Humanizer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; namespace SharedKernel.Extensions; diff --git a/src/SharedKernel/Extensions/OpenTelemetryExtension.cs b/src/SharedKernel/Extensions/OpenTelemetryExtension.cs index 46af69a..ede2671 100644 --- a/src/SharedKernel/Extensions/OpenTelemetryExtension.cs +++ b/src/SharedKernel/Extensions/OpenTelemetryExtension.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; -using OpenTelemetry; using OpenTelemetry.Logs; using OpenTelemetry.Metrics; using OpenTelemetry.Resources; diff --git a/src/SharedKernel/OpenApi/OpenApiExtensions.cs b/src/SharedKernel/OpenApi/OpenApiExtensions.cs index 522ee65..ee64d52 100644 --- a/src/SharedKernel/OpenApi/OpenApiExtensions.cs +++ b/src/SharedKernel/OpenApi/OpenApiExtensions.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using RegexBox; -using Scalar.AspNetCore; using SharedKernel.OpenApi.Options; namespace SharedKernel.OpenApi; diff --git a/src/SharedKernel/OpenApi/UiExtensions.cs b/src/SharedKernel/OpenApi/UiExtensions.cs index 9b6632d..6342946 100644 --- a/src/SharedKernel/OpenApi/UiExtensions.cs +++ b/src/SharedKernel/OpenApi/UiExtensions.cs @@ -1,8 +1,5 @@ -using System.Reflection; using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.Configuration; using Scalar.AspNetCore; -using SharedKernel.Extensions; using SharedKernel.OpenApi.Options; using Swashbuckle.AspNetCore.SwaggerUI; @@ -29,7 +26,7 @@ internal static WebApplication MapSwaggerUi(this WebApplication app, OpenApiConf app.UseSwaggerUI(options => { options.SwaggerEndpoint($"{document.GetEndpointUrl()}", document.Title); - options.RoutePrefix = $"doc/{document.GroupName}"; + options.RoutePrefix = $"swagger/{document.GroupName}"; options.AddPandaOptions(); }); } diff --git a/src/SharedKernel/SharedKernel.csproj b/src/SharedKernel/SharedKernel.csproj index a103239..fd26f75 100644 --- a/src/SharedKernel/SharedKernel.csproj +++ b/src/SharedKernel/SharedKernel.csproj @@ -8,13 +8,13 @@ Readme.md Pandatech MIT - 1.0.15 + 1.0.16 Pandatech.SharedKernel Pandatech Shared Kernel Library Pandatech, shared kernel, library, OpenAPI, Swagger, utilities, scalar Pandatech.SharedKernel provides centralized configurations, utilities, and extensions for ASP.NET Core projects. For more information refere to readme.md document. https://github.com/PandaTechAM/be-lib-sharedkernel - OpenTelemetry bug fix + Swagger enhancment @@ -42,18 +42,18 @@ - + - + - - + +