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

前端 未结 2 499
面向向阳花
面向向阳花 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: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: ...
    

提交回复
热议问题