i am working on a webapi with plugins. I want to update the swagger documentation when a plugin is added. I can handle this when i don't use version. All methods are added to the swagger documentation.
but when the api has apiversion turned on, the generation of the new version swagger document failed. It returns a 404.
do i need to so anything for versioning to work and pick up the dynamic controller functions...
private string AddSwaggerVersionDocument(PluginMetadata metadata)
{
var version = metadata.Version.ToApiVersion();
if (SwaggerElements.GeneratorOptions.SwaggerGeneratorOptions.SwaggerDocs.ContainsKey(version) == false)
{
SwaggerElements.GeneratorOptions.SwaggerDoc(version, new Info
{
Title = "webapi API",
Version = $"{version}",
Description = "Web API demo",
TermsOfService = "None",
Contact = new Contact
{
Name = "Frans van Ek",
Email = string.Empty,
Url = "https://fransvanek.nl"
},
License = new License
{
Name = "Use under LICX",
Url = "https://fransvanek.nl"
}
});
SwaggerElements.UIOptions.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"My API : {version}");
}
return version;
}