no-dollar-ref-sibling-properties
Overview
This rule belongs to the swagger-v2-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 | SWAGGER20STANDARDS_V281 |
Type | Validation |
Rule System | Semantic |
Broad Category | References |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | swagger2 swagger 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://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03
- https://www.rfc-editor.org/rfc/rfc6901
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md
- https://docs.apimatic.io/rulesets/overview/