Jon Kennerly - 197 - Dec 10, 2014

Any possibility of overriding the default path of “http://root/swagger-ui” in the SwaggerFeature? I currently have my swagger files at the root of the api.

Promote this variable to a class level property:

            var swaggerUrl = UseBootstrapTheme
                ? “swagger-ui-bootstrap/”
                : “swagger-ui/”;

                .AddPluginLink(swaggerUrl, “Swagger UI”);

The path needs to be /swagger-ui to match the embedded resource files. If you have Swagger files it should automatically pick up those instead.

If you just wanted to change the link (i.e. not link to SwaggerFeature) you can modify:

appHost.GetPlugin<MetadataFeature>().PluginLinks Dictionary

Jon Kennerly:

That works. As a productionalized product, I want to remove as much as I can about the underlying implementations, such as verbiage with the word “Swagger”.

Took me a while to figure out it has to be done after AppHost.Init().

appHost.GetPlugin<MetadataFeature>().PluginLinks.Remove(“swagger-ui/”); appHost.GetPlugin<MetadataFeature>().PluginLinks.Add(“index.html”, “API Service Browser”);

I do wish this was a property of the SwaggerFeature.
Or a MetaDataFeature.RemovePluginLink(…) to go with the AddPluginLink(…) would also be cleaner.

Thanks again.

Another solution would be to just use a customized copy of the Swagger API from:

Yeah plugins registrations run after Configure(), some info about Plugin Lifecycle at:

In your AppHost you can override OnAfterInit() or register a callback in AppHost.AfterInitCallbacks.

New Remove Plugin API’s added in:

Although you can always add an equivalent API for stuff like this with an extension method.

Jon Kennerly:

good info. Thanks again.