{"id":18447772,"url":"https://github.com/stoplightio/spectral-documentation","last_synced_at":"2025-04-08T00:32:25.444Z","repository":{"id":64272720,"uuid":"565551445","full_name":"stoplightio/spectral-documentation","owner":"stoplightio","description":"Teach Spectral how to help improve the quality of your OpenAPI-based documentation.","archived":false,"fork":false,"pushed_at":"2024-11-13T00:23:43.000Z","size":916,"stargazers_count":10,"open_issues_count":7,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-05T22:43:22.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoplightio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-13T19:03:00.000Z","updated_at":"2025-02-19T21:51:46.000Z","dependencies_parsed_at":"2024-09-14T05:52:51.827Z","dependency_job_id":"0df56eb0-039d-4f33-855f-39061eaf2abf","html_url":"https://github.com/stoplightio/spectral-documentation","commit_stats":{"total_commits":34,"total_committers":3,"mean_commits":"11.333333333333334","dds":0.05882352941176472,"last_synced_commit":"c5fbeae6c38a49d940ff26e79b5dd87f227ec101"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fspectral-documentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fspectral-documentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fspectral-documentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fspectral-documentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoplightio","download_url":"https://codeload.github.com/stoplightio/spectral-documentation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755457,"owners_count":20990618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:14:23.499Z","updated_at":"2025-04-08T00:32:20.426Z","avatar_url":"https://github.com/stoplightio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spectral Documentation Ruleset\n\n[![NPM Downloads](https://img.shields.io/npm/dw/@stoplight/spectral-documentation?color=blue)](https://www.npmjs.com/package/@stoplight/spectral-documentation) [![Stoplight Forest](https://img.shields.io/ecologi/trees/stoplightinc)][stoplight_forest]\n\nScan an [OpenAPI](https://spec.openapis.org/oas/v3.1.0) 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. \n\n## Installation\n\n``` bash\nnpm install --save -D @stoplight/spectral-documentation\nnpm install --save -D @stoplight/spectral-cli\n```\n\n## Usage\n\n\nCreate 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.\n\n```\ncd ~/src/\u003cyour-api\u003e\n\necho 'extends: [\"@stoplight/spectral-documentation\"]' \u003e .spectral.yaml\n```\n\n_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:_\n\n```\necho 'extends: [\"https://unpkg.com/@stoplight/spectral-documentation/dist/ruleset.mjs\"]' \u003e .spectral.yaml\n```\n\n_**Note:** You need to use the full URL with CDN hosted rulesets because Spectral [cannot follow redirects through extends](https://github.com/stoplightio/spectral/issues/2266)._\n\nNext, use Spectral CLI to lint against your OpenAPI description. Don't have any OpenAPI? [Record some HTTP traffic to make OpenAPI](https://apisyouwonthate.com/blog/creating-openapi-from-http-traffic) and then you can switch to API Design-First going forwards.\n\n```\nspectral lint api/openapi.yaml\n```\n\nYou should see some output like this:\n\n```\n/Users/phil/src/protect-earth-api/api/openapi.yaml\n  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\n```\n\nNow 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](https://meta.stoplight.io/docs/spectral/ZG9jOjExNTMyOTAx-continuous-integration) (unless [you want them to](https://meta.stoplight.io/docs/spectral/ZG9jOjI1MTg1-spectral-cli#error-results)).\n\nThere are [a bunch of other rulesets](https://github.com/stoplightio/spectral-rulesets) you can use, or use for inspiration for your own rulesets and API Style Guides.\n\n## 🎉 Thanks\n\n- [Phil Sturgeon](https://github.com/philsturgeon) - Made some of these fairly opinionated but probably reasonable rules.\n\n## 📜 License\n\nThis repository is licensed under the MIT license.\n\n## 🌲 Sponsor \n\nIf you would like to thank us for creating Spectral, we ask that you [**buy the world a tree**][stoplight_forest].\n\n[stoplight_forest]: https://ecologi.com/stoplightinc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fspectral-documentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoplightio%2Fspectral-documentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fspectral-documentation/lists"}