Override “host” and “basePath” at the “/{path}” level

前端 未结 2 496
面向向阳花
面向向阳花 2020-12-07 02:51

PROBLEM STATEMENT:

For a \"strange\" reason, all our operations of an API have different \"host\". We have API like this:

  • operation 1: GET https://hos
相关标签:
2条回答
  • 2020-12-07 03:27

    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

    0 讨论(0)
  • 2020-12-07 03:38

    Overriding the target server at the path or operation level is now supported in OpenAPI 3.0:

    openapi: 3.0.0
    
    servers:
      - url: https://my.api.com/v1
    
    paths:
      /foo:
        # Override the server at path level
        servers:
          - url: https://another.server:8443/basePath
    
        get: ...
        post: ...
    
      /bar:
        get:
          # Override the server at operation level
          servers:
            - url: https://some.other.server/v2
    
        post: ...
    
    0 讨论(0)
提交回复
热议问题