覆盖“主机"和"basePath"在"/{path}"等级 [英] Override "host" and "basePath" at the "/{path}" level
问题描述
问题陈述:
出于奇怪"的原因,我们对API的所有操作都具有不同的主机".我们有这样的API:
For a "strange" reason, all our operations of an API have different "host". We have API like this:
- 操作1:获取https://host1:port1/api/resources
- 操作2:获取https://host1:port2/api/resources/{id}
- 操作3:POST https://host2:port3/api/resources
- 操作4:POST https://host2:port4/api/resources/search
如果我们按原样使用Swagger/OpenAPI,则意味着每个操作创建一个Swagger/OpenAPI规范,因此每个操作只有一个swagger-ui页面,然后需要重新创建索引页面以列出所有API:-/的操作,这正是我们要避免的操作.
If we use Swagger/OpenAPI as it is, it means creating one Swagger/OpenAPI specification per operation, resulting having one swagger-ui page per operation, and then, the need to re-create an index page to list all the operations of an API :-/ which is exactly what we want to avoid.
问题:
1/此功能-在"/{path}"级别覆盖主机"和"basePath"是否有意义?
1/ Does this feature - Override "host" and "basePath" at the "/{path}" level - make sense?
2/有人已经尝试在swagger-ui中实现此功能吗?
2/ Does someone already try to implement this feature in swagger-ui?
3/我可以/应该提议对OpenAPI进行这种更改吗?
3/ Could/should I propose this kind of change to OpenAPI?
欢迎其他有用的评论/意见;-)
Any other useful remarks/comments are welcome ;-)
推荐答案
swagger 2.0规范不支持此功能.不过,它将在下一个版本中添加 ,因此无需添加建议!看到这里:
This is not supported in swagger 2.0 specification. It will be added in the next version though, so no need to add the proposal! See here:
https://github.com/OAI/OpenAPI-Specification/issues/562
这篇关于覆盖“主机"和"basePath"在"/{path}"等级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!