pee*_*eer 1 swagger-ui spring-boot openapi springdoc
我有一个 Spring Boot 应用程序,它从 2 个规范文件生成 2 个 API。我可以swagger-ui通过添加为其中之一生成一个页面
springdoc.swagger-ui.url=/firstAPI.yaml
Run Code Online (Sandbox Code Playgroud)
到application.properties。但是我怎样才能包含第二个 API 呢?
我试过:
springdoc.swagger-ui.urls=/firstAPI.yaml,/secondAPI.yaml
Run Code Online (Sandbox Code Playgroud)
这会创建一个组合http://localhost:8080/v3/api-docs/,但http://localhost:8080/v3/api-docs/尽管可以在顶部栏中的两个规格之间进行选择,但页面显示“无法加载 API 定义”。
您可以使用该属性urls:
springdoc.swagger-ui.urls[0].name = first\nspringdoc.swagger-ui.urls[0].url = /firstAPI.yaml\n\nspringdoc.swagger-ui.urls[1].name = second\nspringdoc.swagger-ui.urls[1].url = /secondAPI.yaml\nRun Code Online (Sandbox Code Playgroud)\n您可以在文档中找到此属性。这个问题还有一个很好的常见问题解答:
\n\n\nspringdoc.swagger-ui.urls.* 属性适合配置外部(/v3/api-docs url)。例如,如果您想在一个应用程序内聚合其他服务的所有端点。不要忘记 CORS 也需要启用。
\n
| 归档时间: |
|
| 查看次数: |
3103 次 |
| 最近记录: |