C
Join ServerC#
help
✅ Adding API Versioning support to swagger ui
DDuke11/25/2022
Hi, I've followed this guide exactly: https://markgossa.com/2022/05/asp-net-6-api-versioning-swagger.html
I am getting the following error
My code: https://gist.github.com/dukesteen/24aa6788b98fc0a0e6b2e3f109d2d884
The stacktrace: https://gist.github.com/dukesteen/e26ad88da76c2e81ee5aec4c65e0ca7a
I am getting the following error
My code: https://gist.github.com/dukesteen/24aa6788b98fc0a0e6b2e3f109d2d884
The stacktrace: https://gist.github.com/dukesteen/e26ad88da76c2e81ee5aec4c65e0ca7a

DDuke11/25/2022
it looks like the configure method is being ran multiple times
DDuke11/25/2022
not sure
DDuke11/25/2022
if I set a breakpoint on the
options.SwaggerDoc(description.GroupName + "x", CreateOpenApiInfo(description));
line, it runs without exceptions for v1 and v2, but then it returns to v1 and throwsDDuke11/25/2022
foreach (var description in _apiVersionDescriptionProvider.ApiVersionDescriptions)
{
try
{
options.SwaggerDoc(description.GroupName, CreateOpenApiInfo(description));
}
catch (Exception ex)
{
// ignored
}
}
This works but feels more like a hack than a solution
DDuke11/26/2022
Turns out I was calling AddSwagger twice
AAccord11/26/2022
Closed!