0

If you have controller which doesn't include mapped branch then how to support that in openAPI document generated by Nswag or Swashbuckle?

I have tried reverse proxy thing but it is not working.

Consider C# ASP.NET Core 2.2 for C# code. For example, I have two APIController with following routes: Controller A: [Route("Clients")] Controller B: [Route("Students")]

Now I have request branching in startup.cs in Configure method where I map each app to different route using something like this

app.Map("/business", businessApp =>
{
   businessApp.UseMvc();
});

app.Map("/school", schoolApp =>
{
   schoolApp.UseMvc();
});

app.UseSwaggerAPI(_swaggerConfiguration);

Now if you want to hit controller A then request will be like this http://localhost/business/Clients and http://localhost/school/students

Now problem here is that in openAPI swagger document swagger.json path points to only controller route, so it returns 404 Not Found while making request. How to fix this document so in swagger document path will be actual path after request branches.

I expect to work routes with branches for swagger/openAPI

Bhavy Bhut
  • 43
  • 1
  • 5

0 Answers0