required-path-parameter-required-attribute
Overview
This rule belongs to the swagger-v2-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 | SWAGGER20STANDARDS_V102 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Parameters |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | swagger2 swagger 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, formData or body. - If the parameter is not expected to be sent in the path, remove the path parameter entry from the parameters list.