path-parameter-cannot-be-optional
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
If the location is set as path
, the parameter must be set as required using the property required
of the Parameter Object. The value of this property must be set to true
.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Path parameter is marked as optional. |
Code | OPENAPI3STANDARDS_V082 |
Type | Validation |
Rule System | Semantic |
Broad Category | Parameters |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation path parameter required |
Suggested Fixes
- Ensure that the boolean property
required
exists in the path Parameter Object. - Ensure that the property
required
has a value set totrue
.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-10
- 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#fixed-fields-10
- 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/