multipart-media-type-for-multi-file-request-body
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
To upload multiple files, a multipart media type must be used in the request body definition.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Current media type is not applicable for multi-file request body definition. |
Code | OPENAPI3STANDARDS_V121 |
Type | Validation |
Rule System | Semantic |
Broad Category | Request Body |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation file multipart body request |
Suggested Fixes
- Replace the current request body media type with a multipart media type.
- If you need support for sending multiple files in the request body, use a multipart media type e.g. multipart/form-data.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#considerations-for-file-uploads
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/