Skip to content

new rule: $ref noticed in invalid places #535

Description

@XVincentX

In both OAS2 and OAS3, $ref is only allowed in certain places. Spectral is resolving all references anywhere, instead of following the rules of the specification.

Consider this document:

swagger: "2.0"
host: localhost
info:
  description: bar
  title: "IO APIs, shared specs"
  version: "0.1"
paths: {}
definitions:  # definitions non può contenere $ref
  $ref: file.yml

This is technically invalid OAS2, since refs is not allowed here. Spectral does not give any feedback, just says this is valid.

I understand and support the use case, however it would be great if I could at least see a warning saying "Yo man, I resolved this for you but you should not do this"

Metadata

Metadata

Assignees

No one assigned

    Labels

    OpenAPIIssues related to the OpenAPI rulesetenhancementNew feature or requesthelp wantedExtra attention is neededjson-refseverything JSON Refs resolving relatedp/medium

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions