Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class GroupingByNamespaceConvention : IControllerModelConvention
public void Apply(ControllerModel controller)
var controllerNamespace = controller.ControllerType.Namespace;
var apiVersion = controllerNamespace.Split(".").Last().ToLower();
if (!apiVersion.StartsWith("v")) { apiVersion = "v1"; }
controller.ApiExplorer.GroupName = apiVersion;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment