object-can-be-a-reference
Overview
This rule belongs to the swagger-v2-standards-validation
ruleset and states that:
A Swagger object can be replaced by a Reference Object if the Swagger v2 Specification explicitly states that the value may be a reference. You can therefore, not use $ref in objects that do not allow replacement by a Reference Object.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | The current object value cannot be a Reference Object. |
Code | SWAGGER20STANDARDS_V280 |
Type | Validation |
Rule System | Semantic |
Broad Category | References |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | swagger2 swagger standards semantic validation reference json pointer ref $ref |
Suggested Fixes
- Remove $ref from the current object and define the referenced component directly in its place.
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/