Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@stoplight/spectral-documentation
Advanced tools
Your documentation is only as useful as the quality of the information you've provided, so make sure you're taking full advantage of the features OpenAPI has to offer.
Scan an OpenAPI description to make sure you're leveraging enough of its features to help documentation tools like Stoplight Elements, ReDoc, and Swagger UI build the best quality API Reference Documentation possible.
npm install --save -D @stoplight/spectral-documentation
npm install --save -D @stoplight/spectral-cli
Create a local ruleset that extends the ruleset. In its most basic form this just tells Spectral what ruleset you want to use, but it will allow you to customise things, add your own rules, turn bits off if its causing trouble.
cd ~/src/<your-api>
echo 'extends: ["@stoplight/spectral-documentation"]' > .spectral.yaml
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/dist/ruleset.mjs"]' > .spectral.yaml
Note: You need to use the full URL with CDN hosted rulesets because Spectral cannot follow redirects through extends.
Next, use Spectral CLI to lint against your OpenAPI description. Don't have any OpenAPI? Record some HTTP traffic to make OpenAPI and then you can switch to API Design-First going forwards.
spectral lint api/openapi.yaml
You should see some output like this:
/Users/phil/src/protect-earth-api/api/openapi.yaml
44:17 warning no-path-versioning #/paths/~1v1 contains a version number. API paths SHOULD NOT have versioning in the path. It SHOULD be in the server URL instead. paths./v1
Now you have some things to work on for your API. Thankfully these are only at the warning
severity, and that is not going to fail continuous integration (unless you want them to).
There are a bunch of other rulesets you can use, or use for inspiration for your own rulesets and API Style Guides.
This repository is licensed under the MIT license.
If you would like to thank us for creating Spectral, we ask that you buy the world a tree.
FAQs
Your documentation is only as useful as the quality of the information you've provided, so make sure you're taking full advantage of the features OpenAPI has to offer.
The npm package @stoplight/spectral-documentation receives a total of 6,089 weekly downloads. As such, @stoplight/spectral-documentation popularity was classified as popular.
We found that @stoplight/spectral-documentation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 25 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.