You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following #1393 and #1355, I'm only suggesting a possible approach for a better API Versioning support.
It would be really useful and less mistake-prone if NSwag could handle the different decleared versions of an API automatically.
Actually, by following #1393, all the different versions of API needs to be registered and configure manually in Startup (version number matching the one in the Controller Attribute, files, etc.).
A possible different approach could be to have something like this:
app.UseSwaggerUi3(typeof(Startup).GetTypeInfo().Assembly, config =>
{
/* Looks inside Controllers for all ApiVersion() attributes and generates a route and a JSON file for each one.
* Also the DefaultUrlTemplate property could be taken from Route() controller attribute, if present.
*/
config.GeneratorSettings.UseMultipleVersions = true;
config.SwaggerRoutes.LoadFromControllers();
// Generic settings for all routes
config.GeneratorSettings.Title = "My Amazing API";
config.GeneratorSettings.Description = "Amazing API functionalities.";
// Specific settings for single route
foreach (var route in config.SwaggerRoutes)
{
route.DefaultUrlTemplate = "{v:apiVersion}/{controller}/{action}/{id?}";
route.DefaultPropertyNameHandling = PropertyNameHandling.CamelCase;
}
});
Thank you!
The text was updated successfully, but these errors were encountered:
Following #1393 and #1355, I'm only suggesting a possible approach for a better API Versioning support.
It would be really useful and less mistake-prone if NSwag could handle the different decleared versions of an API automatically.
Actually, by following #1393, all the different versions of API needs to be registered and configure manually in Startup (version number matching the one in the Controller Attribute, files, etc.).
A possible different approach could be to have something like this:
Thank you!
The text was updated successfully, but these errors were encountered: