# path-parameters-defined

Source: https://apigenie.pl/docs/linter/openapi/rules/path-parameters-defined

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 error, Strict at error, All at error.

This rule checks that every `{placeholder}` of a path has a parameter with `in: path` and that
name, on the path item or on each of its operations.

## Rule details

A placeholder without a parameter has no type, no description and no `required: true`: generated
clients cannot fill it, and generated servers and mocks cannot validate it.

The rule reports `One or more path parameters are missing` on the path item or the operation.

## Configuration

An object with one optional property, `defaultType`: the schema type `--fix` gives the
parameters it adds, `string` by default. `null` turns the fix off.

## Examples

**Good**. The placeholder has its parameter on the path item.

```yaml
paths:
  /users/{userId}:
    parameters:
      - name: userId
        in: path
        required: true
        schema:
          type: string
    get:
      summary: Get a user by ID
```

**Bad**. `userId` is declared nowhere.

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

## Automatic fixes

`--fix` adds the missing parameters to the path item, with `in: path`, `required: true` and a
schema of the configured type.
