How do I specify multiple hosts in OpenAPI (Swagger)?

后端 未结 2 1368
误落风尘
误落风尘 2021-01-12 14:19

Right now my OpenAPI 2.0 YAML file has only one host URL:

host: petstore.test.com
basePath: /

Can I use multiple hosts like this?



        
2条回答
  •  孤城傲影
    2021-01-12 15:03

    It is now possible in OpenApi 3.0

    Here is a description:

    Multiple hosts are supported in OpenAPI 3.0. 2.0 supports only one host per API specification (or two if you count HTTP and HTTPS as different hosts). A possible way to target multiple hosts is to omit the host and schema from your specification and serve it from each host. In this case, each copy of the specification will target the corresponding host.

提交回复
热议问题