no-dollar-ref-sibling-properties
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
The Reference Object can only contain the property $ref
and any sibling properties are not allowed. If specified, the additional properties will be ignored.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | A sibling property of property $ref detected. |
Code | OPENAPI3STANDARDS_V311 |
Type | Validation |
Rule System | Semantic |
Broad Category | References |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation sibling reference json pointer ref $ref |
Suggested Fixes
- Remove all other properties from the Reference Object except
$ref
. - If you do not remove the sibling properties, these properties will likely be ignored by the tools you are importing your file into.
- Use allOf construct to wrap up the $ref object and any sibling data instead.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object
- https://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03
- https://datatracker.ietf.org/doc/html/rfc3986
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/