2

ServiceStack 的 SwaggerUI 实现的文档说明

默认配置要求 ServiceStack 服务在“/api”路径下可用。

但我的 api 在根目录。有没有办法改变 SwaggerUI 的外观?

4

1 回答 1

3

I found /swagger-ui/index.html includes the JavaScript code containing the api location.

        window.swaggerUi = new SwaggerUi({
            discoveryUrl:'../api/resources',
            apiKey:"",
            dom_id:"swagger-ui-container",
            supportHeaderParams: false,
            supportedSubmitMethods: ['get', 'post', 'put']
        });

Change the discoveryUrl to be:

discoveryUrl:'../resources'

The Swagger-UI should then correctly auto-discover the available resources.

于 2013-02-05T19:15:43.470 回答