Swell · API Governance Rules

Swell API Rules

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

7 Rules error 3 warn 3 info 1
View Rules File View on GitHub

Rule Categories

swell

Rules

error
swell-operation-tag-required
Every operation MUST have at least one tag.
$.paths.*[get,post,put,patch,delete]
error
swell-operation-id-camel
operationId MUST be lowerCamelCase.
$.paths.*[get,post,put,patch,delete].operationId
warn
swell-summary-title-case
Operation summaries MUST be in Title Case.
$.paths.*[get,post,put,patch,delete].summary
warn
swell-resource-id-pattern
Path parameter ids should be 24-char hex ObjectIds.
$.paths..parameters[?(@.name=='id' && @.in=='path')].schema.pattern
warn
swell-money-fields-number
Money fields MUST be type number.
$.components.schemas.*.properties[grand_total,sub_total,tax_total,shipment_total,discount_total,price,sale_price,amount,balance,recurring_total].type
info
swell-list-responses-pagination
List responses SHOULD include count, page, results.
$.components.schemas[?(@property.match(/List$/))].properties
error
swell-security-required
Every operation MUST require security.
$.paths.*[get,post,put,patch,delete]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  swell-operation-tag-required:
    description: Every operation MUST have at least one tag.
    given: $.paths.*[get,post,put,patch,delete]
    severity: error
    then:
      field: tags
      function: truthy

  swell-operation-id-camel:
    description: operationId MUST be lowerCamelCase.
    given: $.paths.*[get,post,put,patch,delete].operationId
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  swell-summary-title-case:
    description: Operation summaries MUST be in Title Case.
    given: $.paths.*[get,post,put,patch,delete].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][A-Za-z0-9-]*)(\\s([A-Z][A-Za-z0-9-]*|[a-z]{1,3}))*$"

  swell-resource-id-pattern:
    description: Path parameter ids should be 24-char hex ObjectIds.
    given: $.paths..parameters[?(@.name=='id' && @.in=='path')].schema.pattern
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "[a-f0-9]"

  swell-money-fields-number:
    description: Money fields MUST be type number.
    given: $.components.schemas.*.properties[grand_total,sub_total,tax_total,shipment_total,discount_total,price,sale_price,amount,balance,recurring_total].type
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^number$"

  swell-list-responses-pagination:
    description: List responses SHOULD include count, page, results.
    given: $.components.schemas[?(@property.match(/List$/))].properties
    severity: info
    then:
      function: truthy

  swell-security-required:
    description: Every operation MUST require security.
    given: $.paths.*[get,post,put,patch,delete]
    severity: error
    then:
      field: security
      function: defined

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/swell-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.