valid-type-of-request-parameter-value
Overview
This rule belongs to the apimatic-gavel-validation
ruleset and states that:
When a request parameter value is set in one of the uri
/headers
/body
sections, the value's type must be valid against the schema/type definition present for that parameter in the corresponding operation, for which the test case is defined.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Request parameter value does not use a valid type as per the definition provided in the corresponding operation. |
Code | APIMATICGAVEL_V005 |
Type | Validation |
Rule System | Semantic |
Broad Category | Gavel Request |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | gavel apimatic semantic validation schema type value parameter request operation |
Suggested Fixes
- Analyze the constraints specified for the parameter in the operation parameter schema definition and ensure all the constraints are satisfied.
- If an array is expected, ensure that your value is surrounded by square brackets [ and ].
- If an array is not expected, ensure that your value contains a single item only and is not surrounded by square brackets [ and ].
- If a numeric value is expected, ensure that your value is a valid number and it is not surrounded by single or double quotes.
- If a string value is expected, ensure that it is escaped properly and surrounded by quotes if necessary.
- If an object is expected, ensure that your value is a key-value map.
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.0.3.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-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/