https://github.com/ringcentral/vscode-openapi-linter
OpenAPI Linter as a Visual Code extension
https://github.com/ringcentral/vscode-openapi-linter
Last synced: 12 months ago
JSON representation
OpenAPI Linter as a Visual Code extension
- Host: GitHub
- URL: https://github.com/ringcentral/vscode-openapi-linter
- Owner: ringcentral
- License: mit
- Created: 2022-03-23T16:49:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-24T21:30:53.000Z (about 4 years ago)
- Last Synced: 2025-04-07T20:42:25.599Z (about 1 year ago)
- Language: TypeScript
- Size: 369 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAPI Linter for VS Code

It will lint YAML files which start with "openapi:". By default, it doesn't lint JSON files. You may change the `openApiLinter.validateFiles` settings to enable JSON support.
It is powered by [Spectral](https://stoplight.io/open-source/spectral/). You can specify a custom ruleset file by adding
```
"openApiLinter.spectralRulesetsFile": "/path/to/.spectral.yml"
```
to `settings.json` of VS Code.
You could also put a `.spectral.yml` file at the root folder of your workspace to override the global settings.
If there is neither local nor global `.spectral.yml` specified. A default `.spectral.yml` file with content `extends: ["spectral:oas", "spectral:asyncapi"]` will be used.
## For maintainers and contributors
### References
- Get started: https://code.visualstudio.com/api/get-started/your-first-extension
- Programming guide: https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
- Sample project: https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-sample
- Publish: https://code.visualstudio.com/api/working-with-extensions/publishing-extension
- Demo project for Spectral: https://github.com/tylerlong/spectral-demo
- there is an known issue
### Enable trace logging
Add the following to VS Code `setting.json`:
```
"openApiLinter.trace.server": "verbose"
```
Then go open the "OUTPUT" window of VS Code and check channel "OpenAPI Linter":

### Release
```
yarn vsce package
yarn vsce publish
```
If Azure personal token expired, login dev.azure.com, find the publisher name, find the the token and edit it to extend its lifetime. No need to create a new token.
### Known issues
- https://github.com/tylerlong/spectral-demo#known-issues
- https://github.com/stoplightio/spectral/pull/2062#issuecomment-1108787968