CheckOps
Spectral
Spectral is an Apache-2.0 JSON and YAML linter from Stoplight with ready-made rulesets for OpenAPI, AsyncAPI and Arazzo, used to enforce API style guides in editors and CI.
- API testing
- Open source
- Free
- API Linting
- API Contract Testing
- Command Line
- Javascript
- API & contract testing
- Release & CI gates
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Spectral is a flexible linter for JSON and YAML documents, best known for checking API descriptions. It ships ready-to-use rulesets that validate and lint OpenAPI v2, v3.0, v3.1 and v3.2, AsyncAPI and Arazzo v1 documents, and lets teams write their own rules to build automated API style guides.
A ruleset is a YAML, JSON or JavaScript file that extends built-in rulesets and adds rules. Each rule selects parts of a document with JSONPath and applies a function to them, such as pattern, truthy, length, alphabetical, enumeration or schema. Built-in functions cover most checks, and custom JavaScript functions handle the rest. Severity levels (error, warn, info, hint) decide what fails a build.
Typical rules check that every operation has an operationId and description, that paths use kebab-case, that error responses follow a standard shape, that examples match schemas, or that security schemes are defined. Shared rulesets let an organisation publish one style guide and reuse it across hundreds of APIs.
Spectral runs as a CLI (spectral lint), as a JavaScript library, and inside editors through Stoplight’s VS Code extension. It outputs results in several formats, including human-readable text, JSON, JUnit and HTML, so it fits pre-commit hooks and CI pipelines. Stoplight, the company behind it, is part of SmartBear.
The project has about 3,300 GitHub stars and released v6.17.1 on 6 November 2026.
In the quality loop, Spectral checks API contracts at design time and in CI, before any code runs. It complements contract-testing and breaking-change tools such as oasdiff, Specmatic or Pact: Spectral checks that a description is well-formed and consistent, while those tools check compatibility and behaviour.
The source code is at stoplightio/spectral on GitHub under the Apache-2.0 licence, with about 3,300 stars; the most recent commit was on 6 November 2026.
A good rollout keeps Spectral helpful rather than noisy. Begin with the built-in OpenAPI ruleset in warning mode, fix the issues that matter most, and then promote selected rules to errors so they block merges. Custom rules are where Spectral earns its place: naming conventions, required error formats, pagination patterns and security schemes can all be encoded once and applied to every API description in the organisation. Keep the ruleset in its own repository and version it, so teams can upgrade deliberately. Spectral lints the description, not the running API, so pair it with contract or API tests that check the implementation matches.
Features
- Built-in rulesets: OpenAPI 2.0 to 3.2, AsyncAPI and Arazzo.
- Custom rules: JSONPath selectors plus built-in or custom functions.
- Rule severities: Error, warning, info and hint levels.
- Shared style guides: Extend and publish rulesets across teams.
- Custom functions: Write JavaScript for complex checks.
- CLI and library: Use in terminals, scripts and Node.js.
- Editor integration: Live linting in VS Code via Stoplight’s extension.
- Multiple formats: Text, JSON, JUnit and HTML output, among others.
- Any JSON/YAML: Lint configuration files, not only APIs.
- Overrides: Disable or adjust rules for specific files or paths.
Pros
- Catches issues early: Problems are found before implementation or review.
- Widely adopted: A de facto standard for OpenAPI linting.
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 6 November 2026.
- Community: About 3,300 GitHub stars.
Cons
- Rule writing takes effort: Good style guides need time to design and tune.
- Static checks only: Does not test a running API.
- Noise risk: Overly strict rulesets can overwhelm teams with warnings.
Usage and Links (Example)
Install and lint an OpenAPI file with the built-in ruleset:
npm install -g @stoplight/spectral-cli
echo 'extends: ["spectral:oas"]' > .spectral.yaml
spectral lint openapi.yaml
Add a custom rule:
extends: ["spectral:oas"]
rules:
paths-kebab-case:
description: Paths must be kebab-case.
severity: error
given: "$.paths[*]~"
then:
function: pattern
functionOptions:
match: "^(/[a-z0-9-{}]+)+$"
Practical tips:
- Start with the built-in ruleset, then add a few high-value custom rules.
- Fail CI only on errors at first; treat warnings as advice.
- Publish your ruleset as a package so every API repository uses the same version.
Resources:
Pricing
Spectral is free and open source under the Apache-2.0 licence.
Recommended for?
- API platform teams enforcing style guides across many APIs.
- Design-first teams working with OpenAPI or AsyncAPI.
- Not a fit as a replacement for runtime API tests.
Conclusion
Spectral is the standard open-source linter for API descriptions. It is flexible enough for organisation-wide style guides and simple enough to start with in minutes.
Combined with a breaking-change checker and runtime tests, it gives API teams strong guardrails early in the loop.
On CheckOps, Spectral is filed under the API & contract testing and Release & CI gates stages. Related tools listed here include oasdiff, Stoplight Prism, Specmatic, Schemathesis, SwaggerUI and Dredd. Before choosing, compare them on licence, supported languages and platforms, hosting model, and how well each fits your existing CI pipeline. Facts on this page were checked against the official website, documentation and repository on 11 November 2026; statements the vendor makes about its own product are marked as vendor claims.
Compare
CheckOps pages that put Spectral next to related tools. There is no paid placement on these lists.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Spectral side by side.
Ooasdiffoasdiff is an Apache-2.0 command-line tool that compares OpenAPI specs to produce changelogs and detect breaking changes, with a GitHub Action and a hosted pull-request review workflow.Compare with Spectral
SStoplight PrismAccelerate API development with realistic mock servers powered by API descriptions.Compare with Spectral
SSpecmaticSpecmatic is an MIT-licensed contract-driven development tool that turns API specifications (such as OpenAPI) into executable contracts for contract tests, intelligent service virtualization and backward-compatibility checks.Compare with Spectral
SSchemathesisSchemathesis is an MIT-licensed property-based API testing tool that generates inputs from OpenAPI, GraphQL and gRPC schemas, chains stateful workflows and finds 500s, schema violations and validation gaps.Compare with Spectral
SSwaggerUISwagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.Compare with Spectral
DDreddLanguage-agnostic HTTP API Testing Tool.Compare with Spectral