Ensures that MediaType objects have valid combinations of encoding fields according to the OpenAPI 3.2.0 specification.
OAS | Compatibility |
---|---|
2.0 | ❌ |
3.0 | ❌ |
3.1 | ❌ |
3.2 | ✅ |
According to the OpenAPI 3.2.0 specification, MediaType objects have strict rules about which encoding fields can be used together. This rule ensures that only valid encoding field combinations are used in MediaType objects.
Option | Type | Description |
---|---|---|
severity | string | Possible values: off , warn , error . Default error (in recommended configuration). |
An example configuration:
rules:
spec-no-invalid-encoding-combinations: error
Given this configuration:
rules:
spec-no-invalid-encoding-combinations: error
Example of incorrect MediaType objects:
requestBody:
content:
'multipart/form-data':
schema:
type: object
properties:
id:
type: integer
encoding:
id:
style: form
prefixEncoding:
- style: form
'application/x-www-form-urlencoded':
schema:
type: object
properties:
name:
type: string
encoding:
name:
style: form
itemEncoding:
style: form
Example of correct MediaType objects:
requestBody:
content:
'multipart/form-data':
schema:
type: object
properties:
id:
type: integer
encoding:
id:
style: form
'multipart/form-data-positional':
schema:
type: object
properties:
items:
type: array
prefixEncoding:
- style: form
itemEncoding:
style: form