Skip to main content

get-operation-cannot-have-body-or-form-parameters

Overview

This rule belongs to the swagger-v2-apimatic-linting ruleset and states that:

A GET operation must not define a parameter with location in set as body or formData in the parameters list. This is because such methods do not expect a request body and, therefore, all related information will be ignored automatically during import/transformations in APIMatic.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageBody/Form parameter found in GET operation.
CodeSWAGGER20APIMATIC_L100
TypeLinting
Rule SystemSemantic
Broad CategoryOperations
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger apimatic semantic linting get body formData parameter operation request body

Suggested Fixes

  • Remove all parameters with in set as body or formData from the parameters list of the get Operation Object.
  • If the parameter is declared in the Path Item Object, it gets applied to all operations. Relocate all body/form parameter definitions to the parameters list of all Operation Objects instead, where they are applicable.
  • Change the operation HTTP method to post or any other method that supports request body.

For More Information