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.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Body/Form parameter found in GET operation. |
| Code | SWAGGER20APIMATIC_L100 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | Operations |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | swagger2 swagger apimatic semantic linting get body formData parameter operation request body |
Suggested Fixes
- Remove all parameters with
inset asbodyorformDatafrom theparameterslist of thegetOperation 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
parameterslist of all Operation Objects instead, where they are applicable. - Change the operation HTTP method to
postor any other method that supports request body.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#path-item-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object
- https://www.apimatic.io/
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md
- https://docs.apimatic.io/rulesets/overview/