no-additional-request-parameter
Overview
This rule belongs to the apimatic-gavel-validation
ruleset and states that:
A test case request
parameter whose value may be set in one of the uri
, headers
or body
sections must also be pre-defined in the corresponding operation at the appropriate location. Any parameter which is not pre-defined and its value is specified in the test case will be ignored.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Request parameter is not defined in the corresponding operation. |
Code | APIMATICGAVEL_V007 |
Type | Validation |
Rule System | Semantic |
Broad Category | Gavel Request |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | gavel apimatic semantic validation parameter request operation |
Suggested Fixes
- If the parameter is not expected to be part of the operation, remove the extra parameter value from the test case request.
- Ensure that the name of the parameter in the test case matches exactly with an operation level parameter name and has no typos.
- Parameter names are compared in a case-sensitive manner.
- If the parameter is not yet defined in the operation, add a definition for it at the appropriate location.
- Query string parameters whose value is set in the
uri
section need to be defined in the operationparameters
list using locationin
set asquery
. - Header parameters whose value is set in the
headers
section need to be defined in the operationparameters
list using locationin
set asheader
. This does not, however, apply forAccept
orContent-Type
headers. - Body parameter(s) definined in the
body
section need to be defined in the operation'srequestBody
content section (for OpenAPI v3.0 and above) orparameters
list with locationin
set asbody
/formData
(for OpenAPI v2.0).
For More Information
- https://docs.apimatic.io/specification-extensions/swagger-test-cases-extensions/#http-request
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object
- https://docs.apimatic.io/specification-extensions/swagger-test-cases-extensions/#gavel-specification
- https://docs.apimatic.io/specification-extensions/swagger-test-cases-extensions/#specifying-test-cases-using-gavel-specification
- https://docs.apimatic.io/rulesets/overview/