Skip to main content

get-operation-cannot-have-request-body

Overview

This rule belongs to the openapi-v3-standards-validation ruleset and states that:

HTTP methods like GET, DELETE, HEAD are not allowed to have a request body since a payload for these methods do not have any defined semantics. If request body is defined for non-body HTTP verbs, it will get ignored automatically during import/transformations in APIMatic. Therefore, in OpenAPI as well, the GET Operation Object must not set the requestBody property.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageOperation Object for GET HTTP method cannot have a request body.
CodeOPENAPI3STANDARDS_V053
TypeValidation
Rule SystemSemantic
Broad CategoryOperations
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic validation get request body body parameter operation

Suggested Fixes

  • Remove the requestBody property from the GET Operation Object.
  • Change the HTTP method to POST or any other method that supports request body.

For More Information