spectral icon indicating copy to clipboard operation
spectral copied to clipboard

Empty `source` in result

Open kotofeyskaya opened this issue 3 years ago • 0 comments

Describe the bug We use a ruleset that extends oas ruleset. We have a document with a $ref in it. When we run spectral, the source in the result set is undefined for external refs.

To Reproduce

  1. Given this OpenAPI/AsyncAPI document
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
paths:
  /pets:
    $ref: './external/external-path-1.yaml#/~1pets'

and ref file:

We get the following result:

...
{
 code: "operation-description"
 message: "Operation \"description\" must be present and non-empty string."
 path: (3) ['paths', '/pets', 'get']
 range: {start: {…}, end: {…}}
 severity: 1
 source: undefined
}

Expected behavior

{
 code: "operation-description"
 message: "Operation \"description\" must be present and non-empty string."
 path: (3) ['paths', '/pets', 'get']
 range: {start: {…}, end: {…}}
 severity: 1
 source:'external/external-path-1.yaml'
}

Environment (remove any that are not applicable):

  • Library version: [e.g. 3.0.0]
  • OS: MacOS BigSur
  • Browser: [e.g. Chrome 103]

kotofeyskaya avatar Aug 01 '22 14:08 kotofeyskaya