ui-name-duplicates
Forbids the same literal path segment from appearing more than once in a path.
| Attribute | Value |
|---|---|
| Category | Metadata |
| Maturity | Gold |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient–Strict | Warning |
| Complete | Error |
Intent
Remove redundant resource names that make URLs harder to read.
Flags
Repeated literal segments, compared case-insensitively. Path-parameter segments are ignored.
Does not flag
/accounts/{accountId}/payments/{paymentId} because the literal names are unique and parameter placeholders are ignored.
See it fail
paths:
/accounts/{accountId}/accounts:
get:
responses:
'200':
description: OK
Diagnostic: Path `/accounts/{accountId}/accounts` should not repeat URI names.
Fix it
paths:
/accounts/{accountId}/related-accounts:
get:
responses:
'200':
description: OK
Configure
profiles:
default:
rules:
extends: [recommended]
override:
ui-name-duplicates: warn
Nearby: no-http-verbs-in-paths, path-parameters-on-path-only.