stoplightio / spectral-documentation

Teach Spectral how to help improve the quality of your OpenAPI-based documentation.
8 stars 4 forks source link

VS Code usage instructions in readme not working #3

Closed DawMatt closed 1 year ago

DawMatt commented 1 year ago

Context

Unable to get this ruleset to work with the Visual Studio Code Spectral extension.

Current Behavior

Instructions from readme:

If you're using VS Code or Stoplight Studio then the NPM modules will not be available. Instead you can use the CDN hosted version:

echo 'extends: ["https://unpkg.com/@stoplight/spectral-documentation@1.0.0/dist/ruleset.js"]' > .spectral.yaml

Results with VS Code Extension:

Error popup:

Spectral: An error occurred while validating /Users/xxx/Library/folder pathAPIs/CustomerBalances-OpenAPI.yaml. Please see the 'Spectral' output channel for details.

Output channel details:

Using ruleset file: .
[Error - 9:36:21 PM] An error occurred while validating document /Users/xxx/Library/folder path/APIs/CustomerBalances-OpenAPI.yaml: Unable to read ruleset at /Users/xxx/Library/folder path/APIs/.spectral.yaml. Error: Invalid ruleset provided
seenDependencies (before): 0.

Navigating to URL via browser or curl:

Cannot find package @stoplight/spectral-documentation@1.0.0

Expected Behavior

Visual Studio Code Spectral extension would validate the OpenAPI specification using the spectral ruleset.

Possible Workaround/Solution

None. I also tried using the CLI and rulesets via NPM, but hit different issues so couldn't get the ruleset to work.

Steps to Reproduce

  1. Follow steps in the readme for setting up VS Code
  2. Setup .spectral.yml file as specified
  3. Open an OpenAPI YAML file

Environment

Tried on both Windows 10, and macOS v12.6. Latest VS Code versions and spectral extension versions

DawMatt commented 1 year ago

I've also retried the other instructions in the readme to use NPM to install the CLI and ruleset (now tested on Mac, earlier had tested on Windows). They are not working either.

Command: spectral lint CustomerBalances-OpenAPI.yaml Output: Provided ruleset is not an object

philsturgeon commented 1 year ago

@DawMatt leave it with me! Got a bit more housekeeping and testing to do and this will be ready to rock.

philsturgeon commented 1 year ago

Sorry for the delay, just trying to get somebody with appropriate permissions to make sure v1.0.0 is building, as it was initially built as v0.0.0 by mistake. Once that's done automatic releases will kick in.

@mmarti21 when you get it done can you mark this closed?

philsturgeon commented 1 year ago

v1.0.0 is out now so should be working.