# paths-well-formed

Source: https://api-genie.dev/docs/linter/openapi/rules/paths-well-formed

A rule of the OpenAPI linter, which reads OpenAPI 3.0, 3.1 and 3.2 documents. 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**.

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

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

```yaml
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.
