oas2-host-trailing-slash
Server URL must not have trailing slash.
- Applies to
host- Selects
$- Function
pattern- Specs
- OpenAPI 2.0
Use it
This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:
extends: spectral:oas
rules:
oas2-host-trailing-slash: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
oas2-host-trailing-slash:
description: Server URL must not have trailing slash.
recommended: true
formats:
- OpenAPI 2.0 (Swagger)
given: $
then:
field: host
function: pattern
functionOptions:
notMatch: /$
About this rule
Server URL should not have a trailing slash.