No $ref Siblings

no-$ref-siblings · built-in

info experience: reliabilityexperience: consistency spec: schemas

{{error}}

Property must not be placed among $ref.

Rule definition

The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.

no-$ref-siblings:
  title: No $ref Siblings
  reference: https://spotlight-rules.com/spec/rules/openapi/no-$ref-siblings/
  description: Property must not be placed among $ref.
  message: "{{error}}"
  severity: info
  given: $..[?(@property === '$ref')]
  then:
    function: refSiblings
  tags:
    - format:openapi
    - spec:schemas
    - experience:reliability
    - experience:consistency
  prompt: "You are editing an OpenAPI document to satisfy the Spotlight API
    governance rule 'no-$ref-siblings' (No $ref Siblings). Requirement: Property
    must not be placed among $ref. This rule is evaluated at the JSONPath
    `$..[?(@property === '$ref')]` — inspect every location it matches and
    correct only what violates the rule. Make the smallest change that satisfies
    the rule, leave all unrelated content, key order, comments, and formatting
    unchanged, and keep the document valid OpenAPI. Return only the complete
    corrected document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing an OpenAPI document to satisfy the Spotlight API governance rule 'no-$ref-siblings' (No $ref Siblings). Requirement: Property must not be placed among $ref. This rule is evaluated at the JSONPath `$..[?(@property === '$ref')]` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid OpenAPI. Return only the complete corrected document, with no commentary.
ArtifactOpenAPI
Applies at (given)$..[?(@property === '$ref')]
Severityinfo — educational by default; raise to warn/error to enforce
Referencehttps://spotlight-rules.com/spec/rules/openapi/no-$ref-siblings/