Swagger / OpenAPI Annotation for tags

For those wanting the behaviour similar to that of Swagger 1.2, where it groups the routes in the SwaggerUI on the first part of the route - then this worked for me:

AppHost.Plugins.Add(new ServiceStack.Api.OpenApi.OpenApiFeature() 
{ 
    OperationFilter = (verb, operation) => 
    { 
        var path = operation.Tags[0]; 
        operation.Tags.Clear();
        operation.Tags.Add(path.Split('/').SkipWhile(string.IsNullOrEmpty).First()); 
    } 
});
1 Like