Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base URI and the trailing / #161

Open
nickevansuk opened this issue Oct 13, 2020 · 2 comments
Open

Base URI and the trailing / #161

nickevansuk opened this issue Oct 13, 2020 · 2 comments
Labels
CR3 Issues relating to CR3

Comments

@nickevansuk
Copy link
Contributor

nickevansuk commented Oct 13, 2020

Should Base URI contain a trailing /? The arguments are summarised as follows:

Option 1: Base URI should not include the trailing /

This is the approach taken by Open API 3, where the relative path is appended (no relative URL resolution) to the Base URI. Simple appending is straightforward to implement and unambiguous, and is likely most common amongst implementations.

The Base URI specified in the dataset site would exactly match any OpenAPI machine-readable documentation.

With this approach it is possible to specify behaviour for the path / (as it is not part of the Base URI), which is likely why this is favoured for API documentation such as OpenAPI.

Actions required

  1. Specification should be updated: the Base URI MUST NOT include a trailing /.
  2. The specification should be updated to reference Open API, and make the approach of appending the Base URI to the defined relative path clear.
  3. Tooling must be updated to not use a trailing /.
  4. Validator must ensure Base URIs do not include a trailing /.

Option 2: Base URL should include the trailing /

This approach follows RFC3986, which is already indirectly cited in the current version of the specification, and involves formal relative URL resolution. Relative URL resolution has broad library support, and is compatible with browser behaviour. Simple appending is still possible given the nature of the endpoints defined in the specification.

The Base URI specified in the dataset site would differ from any OpenAPI machine-readable documentation.

Actions required

  1. Specification should be updated: the Base URI MUST include a trailing /.
  2. Relative paths referenced in the specification should be updated to be compatible with relative URL resolution e.g. ./order-quote-templates/{uuid} or order-quote-templates/{uuid}
  3. Validator must ensure Base URIs include a trailing /.
@nickevansuk nickevansuk changed the title https://tools.ietf.org/html/rfc1808#section-4 Base URI and the trailing / Oct 13, 2020
@nickevansuk nickevansuk added the CR3 Issues relating to CR3 label Oct 13, 2020
@nickevansuk
Copy link
Contributor Author

nickevansuk commented Oct 14, 2020

A Google search for “api base url“ returns many examples, the vast majority of which follow the convention outlined by Option 1.

Hence this proposal is to proceed with Option 1, in line with broader conventions.

@nickevansuk
Copy link
Contributor Author

Tooling has now been updated to reflect Option 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR3 Issues relating to CR3
Projects
None yet
Development

No branches or pull requests

1 participant