single-operation-body-parameter
Overview
This rule belongs to the swagger-v1-validation ruleset and states that:
The parameters list provided using the 'parameters' property in the Operation Object must not include more than one parameter definition with paramType set as body. If multiple body parameters are found, their location will be automatically updated to form during import/transformations in APIMatic.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | More than one 'body' parameter found in Operation Object parameters list. |
| Code | SWAGGER1_V501 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Operations |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | swagger1 swagger semantic validation parameter type body operation |
Suggested Fixes
- If you intend to send form parameters in the request body, change
paramTypeof all body parameters toform. - If the intention isn't to send form parameters, keep one body parameter and remove all others from the parameters list.
- If your request body expects multiple fields which are not form parameters, define a model with those fields in the root
modelssection. Then, reference that model in a body parameter's type definition instead of defining multiple body parameters.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/1.2.md#524-parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/1.2.md#523-operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/1.2.md#527-model-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/1.2.md
- https://docs.apimatic.io/rulesets/overview/