1

The REST endpoints of my application all start with /api/. The swagger-ui lists all REST pathes under /api/, which is a mess. I want to set the basepath to /api/, so that only the REST endpoints are shown.

According to https://swagger.io/docs/specification/2-0/api-host-and-base-path/ it should be simple, but using the ServiceStack OpenApiFeature from ServiceStack.API.OpenApi 5.7.0 I can't see where to access that property.

Does anyone know how to set the basepath property?

MichaelP
  • 13
  • 3

1 Answers1

2

You can modify the Open API v2 model using the OpenApiFeature plugins Operation Filters, e.g. you can change the BasePath property with:

Plugins.Add(new OpenApiFeature {
    ApiDeclarationFilter = x => x.BasePath = ...
});

Although I don't expect modifying auto generated properties like BasePath is going to have your desired behavior. ServiceStack's Open API feature only lists ServiceStack Services, not MVC routes.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • Your are right, the MVC routes are not contained, I edited my question. You are also right, that the method you described didn't help to list the routes the way I wanted. Using ServiceStack TagAttribute did the trick! – MichaelP Nov 07 '19 at 19:50