Skip to content

Commit

Permalink
fix: Swagger and DNTCaptcha conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-shirbandi committed Dec 20, 2023
1 parent 84062ee commit a25b4ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace TaskoMask.BuildingBlocks.Web.MVC.Controllers;

public class BaseApiController : Controller
public abstract class BaseApiController : Controller
{
#region Fields

Expand Down
2 changes: 1 addition & 1 deletion src/3-ApiGateways/UserPanel/ApiGateway/ApiGateway.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using Serilog;
using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Captcha;
using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Metric;
using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Serilog;

Expand All @@ -16,6 +17,11 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
{
builder.AddCustomSerilog();

//TODO : Swagger tries to initialize DNTCaptcha.Core built-in controller and throws an error if we remove the bellow lines
// We need to ignore DNTCaptcha.Core during generating swagger docs
builder.Services.AddControllers();
builder.Services.AddCaptcha();

builder.Configuration.AddOcelotWithSwaggerSupport(
(o) =>
{
Expand Down

0 comments on commit a25b4ef

Please sign in to comment.