paths-unique

Since 0.0.1 · In the rulesets: Strict at error, All at error

This rule checks that no two paths match the same requests. Paths that differ only in the names of their placeholders, /users/{id} and /users/{userId}, are the same path.

Rule details

Two path items for one path are two sets of operations for the same requests: a router takes one of them, a documentation tool shows both, and a reader cannot tell which one the server runs.

The rule reports Duplicate path found on the later path item.

Examples

Good. Two paths.

paths:
  /users/{userId}:
    get:
      summary: Get a user by ID
  /users/{userId}/posts:
    get:
      summary: Get a user's posts

Bad. The same path with two placeholder names.

paths:
  /users/{userId}:
    get:
      summary: Get a user by ID
  /users/{id}:
    get:
      summary: Get a user by ID

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.rules has the details.

commands:
  lint:
    rules:
      paths-unique: off
Was this helpful?