Spectral · Schema

Spectral Ruleset

A Spectral ruleset configuration file defining API linting rules and extensions.

API DesignAPI LintingAPI Style GuideAsyncAPIJSON-SchemaOpenAPIQuality Assurance

Properties

Name Type Description
extends object Ruleset(s) to extend. Accepts a string or array of npm package names or URLs.
rules object Map of rule names to rule definitions.
aliases object Map of alias names to JSONPath expressions for reuse across rules.
overrides array Override rule severities for specific file patterns.
formats array Limit ruleset to specific document formats.
View JSON Schema on GitHub

JSON Schema

spectral-ruleset-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://spectral.stoplight.io/schemas/ruleset",
  "title": "Spectral Ruleset",
  "description": "A Spectral ruleset configuration file defining API linting rules and extensions.",
  "type": "object",
  "properties": {
    "extends": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ],
      "description": "Ruleset(s) to extend. Accepts a string or array of npm package names or URLs."
    },
    "rules": {
      "type": "object",
      "description": "Map of rule names to rule definitions.",
      "additionalProperties": {
        "$ref": "#/$defs/Rule"
      }
    },
    "aliases": {
      "type": "object",
      "description": "Map of alias names to JSONPath expressions for reuse across rules.",
      "additionalProperties": {
        "oneOf": [
          { "type": "string" },
          { "type": "array", "items": { "type": "string" } }
        ]
      }
    },
    "overrides": {
      "type": "array",
      "description": "Override rule severities for specific file patterns.",
      "items": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": { "type": "string" }
          },
          "rules": {
            "type": "object",
            "additionalProperties": {
              "oneOf": [
                { "type": "string", "enum": ["error", "warn", "info", "hint", "off"] },
                { "type": "integer", "minimum": 0, "maximum": 3 }
              ]
            }
          }
        },
        "required": ["files", "rules"]
      }
    },
    "formats": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Limit ruleset to specific document formats."
    }
  },
  "$defs": {
    "Rule": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of what the rule enforces."
        },
        "message": {
          "type": "string",
          "description": "Message shown when the rule is violated. Supports {{error}} and {{path}} placeholders."
        },
        "severity": {
          "oneOf": [
            { "type": "string", "enum": ["error", "warn", "info", "hint", "off"] },
            { "type": "integer", "minimum": 0, "maximum": 3 }
          ],
          "description": "Severity level: error(0), warn(1), info(2), hint(3), or off."
        },
        "given": {
          "oneOf": [
            { "type": "string" },
            { "type": "array", "items": { "type": "string" } }
          ],
          "description": "JSONPath expression(s) selecting nodes to test."
        },
        "then": {
          "oneOf": [
            { "$ref": "#/$defs/Then" },
            { "type": "array", "items": { "$ref": "#/$defs/Then" } }
          ]
        },
        "formats": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Limit the rule to specific document formats."
        },
        "recommended": {
          "type": "boolean",
          "description": "Whether to include this rule in recommended mode."
        }
      },
      "required": ["given", "then"]
    },
    "Then": {
      "type": "object",
      "properties": {
        "field": {
          "type": "string",
          "description": "Optional sub-field to apply the function to."
        },
        "function": {
          "type": "string",
          "description": "Name of the Spectral function to apply (truthy, falsy, pattern, schema, enumeration, length, etc.)."
        },
        "functionOptions": {
          "type": "object",
          "description": "Options to pass to the function.",
          "additionalProperties": true
        }
      },
      "required": ["function"]
    }
  }
}

Work with this as data

Every JSON Schema here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for schemas

4 MCP tools reach this
  • find_json_schemasBrowse and filter every JSON Schema in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This JSON Schema
curl "https://apis.io/api/v1/json-schemas/spectral-ruleset"
All schemas
curl "https://apis.io/api/v1/json-schemas?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.