no-path-trailing-slash
Disallows a trailing slash on paths other than /.
| Attribute | Value |
|---|---|
| Category | Operations |
| Maturity | Baseline |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Warning |
| Lenient–Complete | Error |
Intent
Consistent path endings avoid duplicate routes, redirects, and client-cache differences.
Flags
Any path longer than one character whose final character is /.
Does not flag
The root path / or non-root paths without a trailing slash.
See it fail
paths:
/payments/:
get:
responses:
'200': {description: OK}
The diagnostic reports that /payments/ should not have a trailing slash.
Fix it
paths:
/payments:
get:
responses:
'200': {description: OK}
Changing an existing public path can be a compatibility change; coordinate routing and client migration.
Configure
profiles:
default:
rules:
extends: [recommended]
override:
no-path-trailing-slash: warn
Nearby: path-no-duplicate-slash, paths-kebab-case.