# standard-media-types

Source: https://apigenie.pl/docs/linter/openapi/rules/standard-media-types

This rule checks whether requests and responses use only standard media types.

## Rule Details

Using non-standard media types can lead to interoperability issues in the
API's structure.

The `standard-media-types` rule is designed to ensure that all requests and
responses in a schema use only standard media types. The rule works by
iterating over all the requests and responses defined in the schema and
checking if they use any non-standard media types. If such a media type is
found, the rule raises a warning.

## Configuration

None.

## Examples

**Good**.

```yaml
paths:
  /users:
    get:
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
```

**Bad**. `application/x-custom` is not a standard media type.

```yaml
paths:
  /users:
    get:
      responses:
        "200":
          description: OK
          content:
            application/x-custom:
              schema:
                $ref: "#/components/schemas/User"
```

## When Not to Use It

We recommend to always enable this rule.

## Compatibility

This rule is compatible with all OpenAPI 3.x versions.
