Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageMore than one 'body' parameter found in Operation Object parameters list.
CodeSWAGGER1_V501
TypeValidation
Rule SystemSemantic
Broad CategoryOperations
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger1 swagger semantic validation parameter type body operation

Suggested Fixes

  • If you intend to send form parameters in the request body, change paramType of all body parameters to form.
  • 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 models section. Then, reference that model in a body parameter's type definition instead of defining multiple body parameters.

For More Information