# no-content-response-defined

Source: https://api-genie.dev/docs/linter/openapi/rules/no-content-response-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 no `204` response declares `content`.

## Rule details

A 204 response has no body, by the HTTP specification. A document that gives one a schema
promises clients something the server never sends, and generated clients wait for a body that does
not come.

The rule reports `204 response may not have a body defined`.

## Examples

**Good**. The response says only what happened.

```yaml
paths:
  /users/{id}:
    delete:
      responses:
        "204":
          description: User deleted.
```

**Bad**. A body on a 204 response.

```yaml
paths:
  /users/{id}:
    delete:
      responses:
        "204":
          description: User deleted.
          content:
            application/json:
              schema:
                type: object
```

## Automatic fixes

`--fix` removes `content` from the `204` responses the rule reports.
