Spectral Rules

Spectral is the open-source API linting framework developed by Stoplight that validates JSON and YAML artifacts including OpenAPI (v2, v3.0, v3.1), AsyncAPI (v2.x), and Arazzo specifications. Spectral rules are defined in YAML or JavaScript configuration files and consist of rule names, descriptions, severity levels (error/warn/info/hint), given (JSONPath selectors), and then (assertion functions). Originally released in 2018, Spectral has become the de facto standard for API governance linting.

API entry from apis.yml

apis.yml Raw ↑
aid: api-evangelist-standards:spectral-rules
name: Spectral Rules
description: Spectral is the open-source API linting framework developed by Stoplight that validates JSON
  and YAML artifacts including OpenAPI (v2, v3.0, v3.1), AsyncAPI (v2.x), and Arazzo specifications. Spectral
  rules are defined in YAML or JavaScript configuration files and consist of rule names, descriptions,
  severity levels (error/warn/info/hint), given (JSONPath selectors), and then (assertion functions).
  Originally released in 2018, Spectral has become the de facto standard for API governance linting.
humanURL: https://stoplight.io/open-source/spectral
baseURL: https://spectral.stoplight.io
tags:
- Spectral
- Linting
- OpenAPI
- API Governance
- Open Source
properties:
- type: Documentation
  url: https://docs.stoplight.io/docs/spectral
- type: Repository
  url: https://github.com/stoplightio/spectral
- type: NPM
  url: https://www.npmjs.com/package/@stoplight/spectral-cli
- type: VSCode Extension
  url: https://marketplace.visualstudio.com/items?itemName=stoplight.spectral
- type: GitHub Action
  url: https://github.com/marketplace/actions/spectral-linting
features:
- type: OpenAPILinting
  description: Validate OpenAPI 2.0, 3.0, and 3.1 specifications against custom rules
- type: AsyncAPILinting
  description: Validate AsyncAPI 2.x specifications for consistency and standards
- type: ArazzoLinting
  description: Lint Arazzo workflow specifications
- type: CustomFunctions
  description: Extend rules with custom JavaScript functions for complex validation logic
- type: MultiFormatSupport
  description: Validate YAML, JSON, and other structured document formats
- type: CIIntegration
  description: GitHub Actions, GitLab CI, Jenkins, Azure DevOps, and CircleCI support