我正在尝试使用OpenAPI 3.0(1.5.0版本(来记录我的REST API。我的问题是如何更改swagger url以重定向到我的自定义文档?
这是我当前的应用程序.yml文件:
api-docs:
path: /custom/api-docs
swagger-ui:
path: /custom/swagger
config-url: /custom/api-docs
如果我尝试启动我的应用程序并使用此链接访问swagger文档:https://localhost:8080/custom/swagger
我被重定向到https://localhost:8080/custom/swagger-ui/index.html?configUrl=/custom/api文档
这打开了Petstore文档,而不是我的自定义文档。
如果我在URL中手动键入:https://localhost:8080/custom/swagger-ui/index.html?url=/custom/api文档(将configUrl更改为url(它打开了我的自定义文档。
我想要实现的是可能的吗https://localhost:8080/custom/swagger它打开了我的定制招摇医生,而不是宠物店的医生?
如果这很重要,这里是我的依赖:
<!-- Springdoc for OpenAPI 3 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.0</version>
</dependency>
springdoc.swager-ui.configUrl与您的配置无关。
如果您有文档中所述的外部配置文件,这是相关的:
- https://springdoc.org/#swagger-ui属性