pre-defined-operation-parameter-for-request-query-param
Overview
This rule belongs to the apimatic-gavel-validation ruleset and states that:
When defining a query string in the request uri property, each parameter whose value is set in the query string must also be defined in the corresponding operation for which the test case is being defined.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Request query parameter is not defined in the corresponding operation. |
| Code | APIMATICGAVEL_V002 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Gavel Request |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | gavel apimatic semantic validation parameter query request operation |
Suggested Fixes
- In
/pets?pet-id=1,pet-id=1is a query string andpet-idis the name of the query parameter. - The name of the query parameter in the request
urimust match exactly with a parameter defined in the operation'sparameterslist. - The operation level parameter with equal name must have its location
inset asquery. - Ensure that the query string parameter name and the operation level parameter name matches exactly with no typos.
- Parameter names are compared in a case-sensitive manner.
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.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/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/