spectral icon indicating copy to clipboard operation
spectral copied to clipboard

Spectral Crash when "path" is defined as an in parameter

Open UniperMaster opened this issue 2 years ago • 4 comments

Describe the bug

Linting the above open api with the parameter of in type path causes the linting to error, If I change it to query its fine

example.yaml

openapi: 3.0.1
servers:
  - url: 'https://test.co.uk'
paths:
  /users/{userId}:
    get:
      summary: Get a user by ID
      parameters:
        - in: path
          name: userId
          schema:
            type: integer
          required: true
          description: Numeric ID of the user to get

To Reproduce

  1. spectral lint .\example.yaml --verbose
Error #1: Cannot read property 'name' of null
          at name == 'api-versio…  …js/core/index.js:66  _rollupPluginBabelH…
          at eval                  …js/core/index.js:66  _rollupPluginBabelH…
          at _traverseBody         …time/traverse.js:13  cb(scope);
          at _traverse             …time/traverse.js:41  _traverseBody(key, …
          at _traverseBody         …time/traverse.js:17  _traverse(value, sc…

Expected behavior linting results

Environment (remove any that are not applicable):

  • Library version: 6.5.1
  • OS: Windows 10

Additional context running node

UniperMaster avatar Sep 22 '22 12:09 UniperMaster

Hey @UniperMaster! What's your ruleset?

P0lip avatar Sep 22 '22 13:09 P0lip

Hey @P0lip, I ran it without a ruleset the standard spectral:oas

UniperMaster avatar Sep 22 '22 14:09 UniperMaster

Did you install it via npm or did you download the binary? If it's npm/yarn, try upgrading the rulesets package, yarn upgrade @stoplight/spectral-rulesets. I cannot reproduce that issue locally, and I remind myself fixing a similar issue, so my bet is you may be running on an older version of the oas ruleset.

P0lip avatar Sep 22 '22 14:09 P0lip

Thanks that worked, please close

UniperMaster avatar Sep 22 '22 15:09 UniperMaster