From 2caba659a639938ff3cdb8e4b406afde0503bad7 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Thu, 24 Feb 2022 08:53:53 +0300 Subject: [PATCH 1/2] Docs: Add Hide ABP Endpoints Section to Swagger Integration Docs --- docs/en/API/Swagger-Integration.md | 20 +++++++++++++++++-- .../AbpSwashbuckleDocumentFilter.cs | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/en/API/Swagger-Integration.md b/docs/en/API/Swagger-Integration.md index 2e7b331cfc..983016cef5 100644 --- a/docs/en/API/Swagger-Integration.md +++ b/docs/en/API/Swagger-Integration.md @@ -48,9 +48,9 @@ First, we need to use `AddAbpSwaggerGen` extension to configure Swagger in `Conf ```csharp public override void ConfigureServices(ServiceConfigurationContext context) { - var services = contex.Services; + var services = context.Services; - //... other configarations. + //... other configurations. services.AddAbpSwaggerGen( options => @@ -81,6 +81,22 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } ``` +### Hide ABP Endpoints on Swagger UI + +To hide ABP-related endpoints, we can use the `HideAbpEndpoints` method when configuring Swagger options. If you want to hide ABP endpoints, add the following line into your Swagger Configuration: + +```csharp +services.AddAbpSwaggerGen( + options => + { + //... other options + + //Hides ABP Related endpoints on Swagger UI + options.HideAbpEndpoints(); + } +) +``` + ## Using Swagger with OAUTH For non MVC/Tiered applications, we need to configure Swagger with OAUTH to handle authorization. diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs index 5fd05a1460..8bd9c0c81b 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Swashbuckle; public class AbpSwashbuckleDocumentFilter : IDocumentFilter { - protected string[] ActionUrlPrefixes = new[] {"Volo.Abp"}; + protected string[] ActionUrlPrefixes = new[] {"Volo."}; public virtual void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) { From 1c297f82cc9fc5c62da7b418e4074c1ae41d65cd Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Thu, 3 Mar 2022 10:57:08 +0300 Subject: [PATCH 2/2] Update Swagger-Integration.md --- docs/en/API/Swagger-Integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/API/Swagger-Integration.md b/docs/en/API/Swagger-Integration.md index 983016cef5..191fa634ca 100644 --- a/docs/en/API/Swagger-Integration.md +++ b/docs/en/API/Swagger-Integration.md @@ -83,7 +83,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex ### Hide ABP Endpoints on Swagger UI -To hide ABP-related endpoints, we can use the `HideAbpEndpoints` method when configuring Swagger options. If you want to hide ABP endpoints, add the following line into your Swagger Configuration: +If you want to hide ABP's default endpoints, call the `HideAbpEndpoints` method in your Swagger configuration as shown in the following example: ```csharp services.AddAbpSwaggerGen(