0

This is mostly out of curiosity. When reading the OpenApi/Swagger 2.0 specs, basePath is described as follows:

"The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/). The basePath does not support path templating." (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)

I understand why the basePath must start with a leading slash. However, I'm surprised they don't say basePath cannot end with a slash since it would mess up building a full url (i.e. {{host}}{{basePath}}{{path}}

Why is is allowed then?

  • Possibly related: [Is a URL with // in the path-section valid?](https://stackoverflow.com/q/20523318/113116), [URL with multiple forward slashes, does it break anything?](https://stackoverflow.com/q/10161177/113116) – Helen Apr 23 '19 at 08:06
  • You can the OpenAPI Specification authors directly at https://github.com/OAI/OpenAPI-Specification/issues. – Helen Apr 23 '19 at 08:09
  • @Helen Thank you :) – John Koehn Apr 23 '19 at 18:22

0 Answers0