all-required-parameters-present-in-request
Overview
This rule belongs to the apimatic-gavel-validation
ruleset and states that:
A parameter may be marked as required
at any level in the OpenAPI operation definition. When defining the test case request, a value for all such parameters must be present in one of the request
's uri
, headers
or body
sections depending upon the parameter's location set in the operation. This value must be non-empty and non-null.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Value for required parameter is not provided in the request. |
Code | APIMATICGAVEL_V006 |
Type | Validation |
Rule System | Semantic |
Broad Category | Gavel Request |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | gavel apimatic semantic validation value required parameter request operation |
Suggested Fixes
- Ensure that if a parameter is marked as required using the
required
property in an opertaion, its value is set in the relevant section of the test case request. - Ensure that the value provided for the parameter is not empty or null.
- Ensure that the value of the parameter is provided in the correct section of the test case request depending upon its location defined in the operation.
- Value of the operation level query and path parameters must be set in the
uri
section of the test case request. - Value of the operation level header parameters must be set in the
headers
section of the test case request. - Value for parameters from the operation request body content section or
body
/formData
parameters list must be set in thebody
section of the test case request. - Ensure that the name of the parameter in the test case matches exactly with the operation level parameter name and has 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.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/