Skip to main content

no-server-trailing-slash

Disallows a trailing slash in an OpenAPI server URL.

AttributeValue
CategoryMetadata
MaturityBaseline
OpenAPIOpenAPI 3.0, 3.1, 3.2
All rulesetsError

Intent

Joining a slash-terminated base URL to a slash-prefixed path can produce duplicate separators and inconsistent request URLs.

Flags

An object-valued server whose textual url is longer than one character and ends with /.

Does not flag

The single-character URL /, URLs without a trailing slash, non-string URLs, or non-object server entries.

See it fail

servers:
- url: https://api.example.test/v1/

Diagnostic: Server `url` should not have a trailing slash.

Fix it

servers:
- url: https://api.example.test/v1

Configure

profiles:
default:
rules:
extends: [recommended]
override:
no-server-trailing-slash: warn

Nearby: no-path-trailing-slash, no-empty-servers.