required-path-parameter-required-attribute
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
If the Parameter Object location is set to path it must specify the property required with value set to true.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Missing required property required in the path Parameter Object. |
| Code | OPENAPI3STANDARDS_V081 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Parameters |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation required path parameter |
Suggested Fixes
- Add missing
requiredproperty in the path Parameter object. requiredis a boolean property withtrueorfalseas possible values. For path parameters, it must be set totrueonly.- If the parameter is not expected to be sent in the path i.e. it is not a template parameter, change the location from
pathto the desired location e.g. query, header, cookie. - If the parameter is not expected to be sent in the path, remove the path parameter entry from the parameters list.
For More Information
- 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#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/