Reconsider multiple basePath values
See original GitHub issueThis was one of those features that shipped with swagger 1.0, 1.1, and 1.2 but was removed in 2.0.
The current spec does not allow multiple hosts to be defined for execution. You can host the spec in different pieces and across multiple hosts, but the execution shall be for a single host. That host is configurable in the spec, but it applies to all operations.
There has been pushback on this from a number of people so I’d like to put it back out in the open. We can reintroduce a construct for multiple hosts. Having gone through the pains of both implementing and supporting it in tools, I would strongly suggest we do not.
My reasoning:
- Often different hosts have different authorization mechanisms. If we re-introduce this feature, we’ll need to support scoping authorizations to a particular host.
- Spanning different protocols (calling a
http
operation from ahttps
-hosted page, for example) introduces show-stopping compatibility issues for web-based tools. Multiple hosts in a single spec will exacerbate this issue - The original support was intended for microservices, which is now better served by apis.json.
So this ticket gives some background and a recommendation for the next version. If there is strong objection, now is the time.
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (15 by maintainers)
Top GitHub Comments
I think we should consider real life scenarios for this issue. Most common is separate base paths for file uploads, for example in Google APIs https://www.googleapis.com/drive/v3 https://www.googleapis.com/upload/drive/v3
https://www.googleapis.com/youtube/v3 https://www.googleapis.com/upload/youtube/v3
Or different subdomain: https://uploady.com/v1/api/ https://content.uploady.com/v1/api/
https://api.dropboxapi.com/2 https://content.dropboxapi.com/2
I think RAML have pretty good solution for this problem: https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md#base-uri-parameters
And I think template parameters in
host
andbasePath
also needed for other things like separate subdomain for sandbox, allow to choose server location, etc.creating separate spec document with code duplication if you have more than one subdomain is so stupid