Skip to main content

valid-schema-content-media-type

Overview

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

Media type of string content can be defined using the contentMediaType property of a Schema Object which must be in compliance with RFC2046.

PropertyValue
EnabledYes
Maximum SeverityError
MessageValue of property contentMediaType in Schema Object is invalid.
CodeOPENAPI3SYNTAX_V143
TypeValidation
Rule SystemSyntax
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi syntax validation media type content string json schema schema

Suggested Fixes

  • A media type consists of a top-level type and a subtype, which is further structured into a tree. A media type can optionally define a suffix and parameters as well.
  • A media type follows a pattern like the following where segments between [] are optional segments: <type>/[<tree>.]<subtype>[+<suffix>]*[;<parameter>]
  • Some examples of valid media types are: application/json, application/vnd.api+json, text/plain.
  • Some common top-level types include the following: text, image, audio, video, application, multipart, message.

For More Information