-
-
Notifications
You must be signed in to change notification settings - Fork 268
Open
Description
Describe the bug
Using a $ref keyword under a path http verb started producing an error in version 1.19.0 of the spectral-rulesets package:
error oas3-schema Property "$ref" is not expected to be here. paths./<some_path>.<some_verb>.$ref
This behavior is not present in spectral-rulesets 1.18.1 and earlier.
To Reproduce
- Given this OpenAPI document
openapi: 3.0.3
info:
title: Foo
version: 1.0.0
description: Foo API
contact:
name: Foo
tags:
- name: FooTag
servers:
- url: https://example.com
description: Example
paths:
/foos:
get:
$ref: 'foo_request.yaml'# foo_request.yaml
description: Get a list of foos
summary: List Foos
operationId: foosIndex
tags:
- FooTag
responses:
"200":
description: A collection of foos
content:
application/json:
schema:
type: object
properties:
foos:
type: array
description: The list of foos
items:
type: string- Run this CLI command
npx spectral lint openapi.yaml
- See error
openapi.yaml
16:9 error oas3-schema "get" property must have required property "responses". paths./foos.get
17:13 error oas3-schema Property "$ref" is not expected to be here. paths./foos.get.$ref
Expected behavior
Using version 1.18.1 of the spectral-rulesets package produces the expected behavior:
No results with a severity of 'error' found!
Environment (remove any that are not applicable):
- Library version: 6.11.1
- OS: macOS Ventura
Additional context
If I had to hazard a guess, I suspect this change to be the culprit: #2574
afmhenry, lesteenman, shanehead, Martin-happy, super-mcgin and 1 more
Metadata
Metadata
Assignees
Labels
No labels