Why don't host and basePath support path templating?
See original GitHub issueThe Swagger 2 schema says that neither host nor basePath support path templating. We probalby discussed this but I donāt remember the exact reason and it seems like a big limitation. Itās common to have parameters in either the host or in the basePath. You can at least work around the basePath limitation with excessively long paths, but there is no workaround for parameter in a host. Swagger will force you to hardcode a value.
Real-world examples:
- Host parameter:
- basePath parameter
I think the reason may have been just:
- We didnāt have a plan for global parameters (though we do define available global parameters which is likely good enough, because using a parameter in a host or basePath template could imply or require a $ref to the parameter name)
- We just didnāt have enough time to put together a sample and tests before Swagger 2 was released
Itās also worth noting that neither host nor basePath are required, nor are they required to resolve to the actual API (e.g. you could set your host to example.com
).
Iām hoping to at least get support targeted for the next spec, if not an update to this spec clarifying that host/basePath templating is not required but may be supported by some projects.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:34 (8 by maintainers)
Top GitHub Comments
š Weād like to provide access to Swagger UI both via a reverse proxy and by directly connecting to the host.
@webron, could you please give the link to it ^ ?