Skip to main content

ref-has-siblings

Disallows properties beside a textual $ref in Swagger 2.0 and OpenAPI 3.0.

AttributeValue
CategoryMetadata
MaturityPlatinum
OpenAPISwagger 2.0; OpenAPI 3.0
StarterOff
Lenient–StrictWarning
CompleteError

Intent

In these versions, sibling properties can be ignored when $ref replaces the containing object, creating documentation that appears effective but is not.

Flags

Every sibling key in an object containing a textual $ref. One object with two siblings produces two findings.

Does not flag

A standalone $ref, a non-text $ref, or any document using OpenAPI 3.1 or 3.2.

See it fail

Alias:
$ref: '#/components/schemas/Base'
description: Alias of Base
type: string

Both description and type are reported.

Fix it

For a schema, compose the reference and added constraints:

Alias:
allOf:
- $ref: '#/components/schemas/Base'
description: Alias of Base

Or move to OpenAPI 3.1+ where supported $ref siblings have updated semantics.

Configure

profiles:
default:
rules:
extends: [recommended]
override:
ref-has-siblings: error

Nearby: no-unresolved-refs, spec-strict-refs.