Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDN hosted version not working #14

Closed
vanam opened this issue Oct 21, 2022 · 7 comments
Closed

CDN hosted version not working #14

vanam opened this issue Oct 21, 2022 · 7 comments

Comments

@vanam
Copy link

vanam commented Oct 21, 2022

Current Behavior

If my .spectral.yml looks like

extends: ["https://unpkg.com/@stoplight/spectral-owasp-ruleset"]

as you write in your documentation I get following error.

$ spectral lint .spectral.yml https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml --verbose
Error running Spectral!
Error #1: Invalid ruleset provided
          at assertRuleset         …idation/index.js:14  throw new Error('In…
          at read                  …or/dist/index.js:20  (0, validation_1.as…
          at processTicksAndReje…  …cess/task_queues:96
          at async processExtend   …rmers/extends.js:22  return await (0, __…
          at                       …rmers/extends.js:40

The same happens if I use your Docker image.

If I install @stoplight/spectral-owasp-ruleset package and my .spectral.yml looks like

extends: ["@stoplight/spectral-owasp-ruleset"]

it works as expected.

Environment

  • Version used: 6.5.1
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Node.js v16.13.2
  • Operating System and version (desktop or mobile): Windows 10
@philsturgeon
Copy link
Contributor

There's an issue with Spectral not following redirects via extends, so for now use https://unpkg.com/@stoplight/spectral-owasp-ruleset@1.1.1/dist/ruleset.js and I'll update the README so others don't have the issue.

@vanam
Copy link
Author

vanam commented Oct 24, 2022

@philsturgeon Thanks for a README update. There is no 1.3.1 version for @stoplight/spectral-owasp-ruleset, though.

Example should be

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

instead.

@philsturgeon
Copy link
Contributor

Thanks, copy and paste mistake. Fixed that.

@Eddoson
Copy link

Eddoson commented Oct 24, 2022

Hello, I'm having this same issue except I can't get either of the suggested .spectral.yaml extends lines to work.

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

I loaded the suggested CDN from the readme

spectral lint .\openapi.yaml

The following error occurs:

Error running Spectral!
Error #1: Invalid ruleset provided
          at assertRuleset         …idation/index.js:14  throw new Error('In…
          at read                  …or/dist/index.js:20  (0, validation_1.as…
          at async migrateRuleset  …or/dist/index.js:31  const ruleset = awa…
          at async getRuleset      …ls/getRuleset.js:47  const migratedRules…
          at async lint            …linter/linter.js:16  const ruleset = awa…

Now attempting to use the npm version

echo 'extends: ["@stoplight/spectral-owasp-ruleset"]' > .spectral.yaml
spectral lint .\openapi.yaml

The following error occurs:

Error running Spectral!
Error #1: Invalid ruleset provided
          at assertRuleset         …idation/index.js:14  throw new Error('In…
          at read                  …or/dist/index.js:20  (0, validation_1.as…
          at async migrateRuleset  …or/dist/index.js:31  const ruleset = awa…
          at async getRuleset      …ls/getRuleset.js:47  const migratedRules…
          at async lint            …linter/linter.js:16  const ruleset = awa…

The NPM ruleset also failed

Let me know if you want any more information. Perhaps I missed something?

@vanam
Copy link
Author

vanam commented Oct 25, 2022

@Eddoson My guess is you have a .spectral.yml file with some invalid content (yml might have a priority over yaml file).

Try

spectral lint .spectral.yaml .\openapi.yaml

to make sure you use right file.

But I might be completely wrong.

@Eddoson
Copy link

Eddoson commented Oct 25, 2022

@vanam You fixed it! Thank you very much. I deleted the .spectral.yaml entirely and created a brand new file and pasted in the extends code rather than using echo then it worked.

@emi-emi671
Copy link

I am also having the same problem but a different error. I added the
echo 'extends: ["https://unpkg.com/@stoplight/spectral-owasp-ruleset@1.1.1/dist/ruleset.js"]' > .spectral.yaml
and when trying to lint the file:
spectral lint .spectral.yaml api.yaml
getting the error:
Provided ruleset is not an object

Any clue of that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants