Skip to main content

spec-no-invalid-encoding-combinations

Disallows encoding beside either prefixEncoding or itemEncoding in OpenAPI 3.2.

AttributeValue
CategoryOperations
MaturityPlatinum
OpenAPIOpenAPI 3.2
Starter–LenientOff
Recommended–CompleteError

Intent

Legacy property-based encoding and OpenAPI 3.2 sequential encoding describe different models. Combining them makes precedence ambiguous.

Flags

Any object in an OpenAPI 3.2 document containing encoding together with prefixEncoding, itemEncoding, or both.

Does not flag

Objects using only encoding, only the sequential encoding fields, or documents earlier than OpenAPI 3.2.

See it fail

multipart/mixed:
encoding: {}
itemSchema:
type: string
itemEncoding:
contentType: text/plain

Diagnostic: The 'encoding' field cannot be used together with 'prefixEncoding' or 'itemEncoding'.

Fix it

Choose the OpenAPI 3.2 sequential model:

multipart/mixed:
itemSchema:
type: string
itemEncoding:
contentType: text/plain

Configure

profiles:
default:
rules:
extends: [recommended]
override:
spec-no-invalid-encoding-combinations: warn

Nearby: request-mime-type, response-mime-type.