How can I find all available routes? When I add the MetadataFeature or NativeTypesFeature, how do I know what routes have been added?
The NativeTypes feature generates your entire Service Contract. E.g. you can view any
[Route] attributes in the generated
But only the .NET Languages includes Routes, all other languages send Request DTOs to the pre-defined endpoint.
The closest I could find for what I’m looking for is RestPaths. My thought was to use RawHttpHandlers to redirect any routes I don’t want available. Is RestPaths the best way to find all available routes?
The metadata for all operations is available from
Metadata.OperationsMap contains all operations indexed by Request DTO Type. In Each Operation there’s a
Routes collection containing all user-defined Routes for that operation.
This metadata is also visible in your
/metadata page in DebugMode
Which provides a dump of the Services Metadata in a table grid view.
I was making progress until I ran into OpenApiFeature. The metadata page and OperationsMap doesn’t contain “/swagger-ui”, it only contains “/openapi”.
/swagger-ui isn’t a Service/Operation, it just returns a static HTML UI that uses Ajax to load the
/openapi endpoint onload which returns a JSON Open API specification of your Services to render its UI.
OK is there a way to find all the URLs that will return HTML? I’m trying to find all URLs that will return something. I can’t have anything undocumented. How do I know if there is a route like /swagger-ui-dark and /swagger-ui-light?
That’s not possible, any Request Handlers can return HTML where they can choose to respond to any route within their compiled opaque implementation, e.g. Swagger UI/Open API return their HTML page within a
For ServiceStack Plugins that have UI’s, it registers a link to its UI within the Plugin or Debug Links on the metadata page, where Debug Links are only visible in
DebugMode and Plugin Links are always visible.
Then there’s any static
.html or Razor
.cshtml in your App that can return HTML, which you can use the Virtual File System APIs to traverse them.