paths-well-formed

Since 0.0.1 · fixed by --fix · In the rulesets: Recommended at warning, Strict at error, All at error

This rule checks that every path starts with one slash, ends without one, has no empty segment (//), no empty placeholder ({}) and no upper-case letter outside the placeholders.

Rule details

A path that breaks one of these joins badly with the server URL or matches nothing: //users is an absolute URL to a host called users in some clients, /users/ and /users are two routes in most servers, and {} is a placeholder no parameter can declare.

The rule reports Path is not well-formed ... on each such path.

Examples

Good.

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

Bad. A double slash, an empty placeholder and a trailing slash.

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

Automatic fixes

--fix adds the leading slash, collapses repeated slashes, removes the trailing slash and the empty placeholders, and lowercases the path outside the placeholders.

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-well-formed: off
Was this helpful?