The REST Lens VS Code extension provides real-time API design evaluation directly in your editor. Get instant feedback on OpenAPI specifications as you write them.
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "REST Lens"
- Click Install
From VSIX File
Download the latest .vsix file from GitHub Releases and install:
code --install-extension restlens-x.x.x.vsix
Getting Started
1. Sign In
- Click the REST Lens: Sign In button in the status bar (bottom right)
- Enter your REST Lens API URL (default:
https://restlens.com) - Complete authentication in your browser
- Select a project when prompted
2. Open an OpenAPI Specification
Open any .yaml, .yml, or .json file containing an OpenAPI specification. The extension automatically detects OpenAPI files by looking for the openapi: or "openapi" key.
3. View Violations
Violations appear as:
- Inline diagnostics - Squiggly underlines in your code
- Problems panel - Full list of issues (View > Problems or Ctrl+Shift+M)
- Status bar - Quick summary with violation count and severity
Features
Real-time Evaluation
The extension evaluates your OpenAPI specification:
- On save (default) - Evaluates when you save the file
- On type (optional) - Evaluates as you type with debounce
Status Bar
The status bar shows:
- Sign In - Click to authenticate
- Evaluating... - Evaluation in progress
- X issues - Number of violations found (click to open Problems panel)
- Ready - No issues found (click to trigger manual evaluation)
Colors indicate severity:
- Red - Has error-level violations
- Yellow - Has warning-level violations
- No color - Info-level only or no issues
Violation Severity
Each violation has a severity level configured in your REST Lens project:
- Error - Critical issues that should be fixed
- Warning - Potential issues to review
- Info - Suggestions and best practices
Configuration
Workspace Settings
Project configuration is stored in .vscode/settings.json:
{
"restlens.organization": "my-org",
"restlens.project": "my-project"
}
These are automatically set when you select a project after signing in.
User Settings
Configure extension behavior in VS Code settings:
| Setting | Default | Description |
|---|---|---|
restlens.evaluateOnSave | true | Evaluate specs when saving |
restlens.evaluateOnType | false | Evaluate specs while typing |
restlens.debounceMs | 1000 | Debounce delay for evaluate-on-type (ms) |
restlens.includeInfoSeverity | false | Show info-level violations |
restlens.apiUrl | https://restlens.com | Fallback API URL |
Commands
Access commands via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description |
|---|---|
REST Lens: Sign In | Authenticate with REST Lens |
REST Lens: Sign Out | Clear stored credentials |
REST Lens: Select Project | Choose a different project |
REST Lens: Evaluate | Manually trigger evaluation |
REST Lens: Clear Cache | Clear cached evaluation results |
Troubleshooting
"Sign in to REST Lens to see API design violations"
You need to authenticate first. Click the status bar item or run REST Lens: Sign In.
"Run 'REST Lens: Select Project' to enable evaluation"
After signing in, you need to select a project. Run REST Lens: Select Project from the Command Palette.
Violations not appearing
- Ensure the file is a valid OpenAPI specification (has
openapi: "3.x.x") - Check that you're signed in (status bar shows "Ready" or violation count)
- Try saving the file to trigger evaluation
- Check the Output panel (View > Output > REST Lens) for errors
Wrong API URL
The API URL is stored with your authentication. To change it:
- Run REST Lens: Sign Out
- Run REST Lens: Sign In
- Enter the correct API URL when prompted
Security
- Credentials are stored securely in VS Code's SecretStorage
- API URL is stored with your authentication tokens
- Project settings are stored in workspace settings (
.vscode/settings.json) - No sensitive data is stored in plain text files
Requirements
- VS Code 1.85.0 or later
- REST Lens account with at least one project
Source Code
The extension is open source: github.com/Edthing/restlens-ide