Skip to main content

no-schema-content-media-type-for-pre-defined-file-media-type-value

Overview

This rule belongs to the openapi-v3-standards-validation ruleset and states that:

The media type for a file upload can be specified in several ways e.g. by using the content key when defining the Media Type Object, the contentType property in the Media Type Object's encoding information, or the contentMediaType property in the Media Type Object's schema definition. When the media type is already specified using the Media Type Object's key, or by the contentType field of an Encoding Object, the contentMediaType keyword will be ignored if present.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageFile's media type is already specified, therefore, the value of contentMediaType in the Media Object schema will be ignored.
CodeOPENAPI3STANDARDS_V136
TypeValidation
Rule SystemSemantic
Broad CategoryMedia Types
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic validation file media type content type content schema encoding

Suggested Fixes

  • Remove the contentMediaType property from the Schema Object unless the schema definition is placed in an external/non-OAS document and may be independently used outside OpenAPI context as well.
  • Remove the contentType property from the Encoding Object referenced by the Media Type Object's encoding definition if it is redundant.

For More Information