Sonar · API Governance Rules

Sonar API Rules

Spectral linting rules defining API design standards and conventions for Sonar.

8 Rules error 2 warn 4 info 2
View Rules File View on GitHub

Rule Categories

sonar

Rules

warn
sonar-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
error
sonar-operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
sonar-tags-required
All operations must have tags
$.paths[*][get,post,put,patch,delete]
info
sonar-organization-param-required
SonarCloud organization-scoped endpoints should include organization parameter
$.paths[*].get.parameters[*].name
error
sonar-200-get-response
GET operations must define 200 response
$.paths[*].get.responses
warn
sonar-bearer-auth
All protected endpoints must use bearerAuth security scheme
$.paths[*][get,post,put,patch,delete]
warn
sonar-response-schema
Successful GET responses must include schemas
$.paths[*].get.responses[200].content
info
sonar-pagination-support
Search/list endpoints should support standard p and ps pagination
$.paths[*search*].get.parameters[*].name

Spectral Ruleset

Raw ↑
rules:
  sonar-operation-summary-title-case:
    description: All operation summaries must use Title Case
    message: Operation summary "{{value}}" must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-z]*(\\s[A-Z][a-z]*)*$"

  sonar-operation-id-required:
    description: All operations must have an operationId
    message: Operation must have an operationId
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  sonar-tags-required:
    description: All operations must have tags
    message: Operation must have at least one tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  sonar-organization-param-required:
    description: SonarCloud organization-scoped endpoints should include organization parameter
    message: Organization-scoped endpoints should include an 'organization' parameter
    severity: info
    given: "$.paths[*].get.parameters[*].name"
    then:
      function: enumeration
      functionOptions:
        values: [organization, organizationKey, project, component, componentKeys, q, p, ps, branch, pullRequest]

  sonar-200-get-response:
    description: GET operations must define 200 response
    message: GET operation must have a 200 response
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: truthy

  sonar-bearer-auth:
    description: All protected endpoints must use bearerAuth security scheme
    message: Protected operation should define bearerAuth security
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  sonar-response-schema:
    description: Successful GET responses must include schemas
    message: Response 200 must include a content schema
    severity: warn
    given: "$.paths[*].get.responses[200].content"
    then:
      function: truthy

  sonar-pagination-support:
    description: Search/list endpoints should support standard p and ps pagination
    message: Search endpoints should include 'p' and 'ps' query parameters
    severity: info
    given: "$.paths[*search*].get.parameters[*].name"
    then:
      function: enumeration
      functionOptions:
        values: [q, p, ps, organization, filter]

Work with this as data

Every ruleset 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 spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset 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 ruleset
curl "https://apis.io/api/v1/rules/sonar-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

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

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

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