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.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Value of property contentMediaType in Schema Object is invalid. |
Code | OPENAPI3SYNTAX_V143 |
Type | Validation |
Rule System | Syntax |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 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
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-8.4
- https://datatracker.ietf.org/doc/html/rfc2046
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/