valid-encoding-content-type
Overview
This rule belongs to the openapi-v3-syntax-linting
ruleset and states that:
Encoding content type value can be a specific media type (e.g. application/json), a wildcard media type range (e.g. image/*), or a comma-separated list of the two types. Media type definitions must be in compliance with RFC6838.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | The value of encoding content type is invalid. |
Code | OPENAPI3SYNTAX_L080 |
Type | Linting |
Rule System | Syntax |
Broad Category | Encoding |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax linting content type content encoding |
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.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encoding-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-types
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encoding-object
- https://www.rfc-editor.org/rfc/rfc6838
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-types
- https://tools.ietf.org/html/rfc6838
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/