RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Allow relative path to swagger.json #3207

Open cnshenj opened 3 years ago

cnshenj commented 3 years ago

An API may have more than one URIs, e.g. https://myapi.com/, or https://allapis.com/my. When accessed via myapi.com, the Swagger page works fine. When accessed via allapis.com/my, the Swagger page allapis.com/my/swagger/index.html should load allapis.com/my/swagger/v1/swagger.json, but it actually tries to load allapis.com/swagger/v1/swagger.json (missing /my).

Relative path can solve this problem. But NSwag uses Microsoft.AspNetCore.Http.PathString which requires an absolute path.

kisalay19 commented 3 years ago

I am also having a similar issue and concern. Anyone got any working solution for this?

jeremyVignelles commented 3 years ago

Not that I'm aware of. please do a PR