spectral:oas error on by default

no-$ref-siblings

Property must not be placed among $ref

Applies to
$ref
Selects
$..[?(@property === '$ref')]
Function
refSiblings
Specs
OpenAPI 2.0OpenAPI 3.0
Message
{{error}}

Use it

This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:

extends: spectral:oas
rules:
  no-$ref-siblings: error   # or off, or another severity

Definition

As defined in @openlint/openlint-rulesets. Functions show by name.

no-$ref-siblings:
  description: Property must not be placed among $ref
  message: '{{error}}'
  severity: 0
  recommended: true
  formats:
    - OpenAPI 2.0 (Swagger)
    - OpenAPI 3.0.x
  given: '$..[?(@property === ''$ref'')]'
  resolved: false
  then:
    function: refSiblings

Sources