Disallow servers with a trailing slash.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ✅ |
| 3.1 | ✅ |
| 3.2 | ✅ |
The endpoint URL is the server URL joined with the path. The path must start with a slash. If the server ends with a slash, there are double slashes. You can get awkward URLs like https://example.com/api//pets.
This rule helps prevent such issues. Servers should not end with a trailing slash. Hands-down a good rule for every API designer.
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
no-server-trailing-slash: errorGiven this configuration:
rules:
no-server-trailing-slash: errorExample of incorrect server:
servers:
- url: https://swift-squirrel.remockly.com/
description: Mock serverExample of correct server:
servers:
- url: https://swift-squirrel.remockly.com
description: Mock server