Affinda · API Governance Rules

Affinda API Rules

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

8 Rules error 2 warn 5 info 1
View Rules File View on GitHub

Rule Categories

affinda

Rules

error
affinda-paths-must-be-v3-prefixed
All Affinda API paths must be prefixed with /v3/.
$.paths[*]~
warn
affinda-paths-must-be-snake-case
Affinda uses snake_case in path segments (e.g. /v3/document_types, /v3/resthook_subscriptions).
$.paths[*]~
error
affinda-must-use-bearer-or-apikey
Affinda accepts Bearer tokens via Authorization header.
$.components.securitySchemes[*]
warn
affinda-operations-must-have-tags
Every Affinda operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
affinda-operations-should-have-operationId
Operations should declare an operationId for SDK generation.
$.paths[*][get,post,put,patch,delete]
warn
affinda-summaries-should-be-title-case
Operation summaries should use Title Case.
$.paths[*][get,post,put,patch,delete].summary
info
affinda-no-deprecated-tag-in-public-spec
Endpoints tagged "Deprecated End Points" should not be promoted to consumers.
$.paths[*][get,post,put,patch,delete].tags[*]
warn
affinda-server-must-be-regional
The server URL must use the Affinda regional pattern.
$.servers[*].url

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
documentationUrl: https://github.com/api-evangelist/affinda/blob/main/rules/affinda-rules.yml
formats: [oas3]
rules:
  affinda-paths-must-be-v3-prefixed:
    description: All Affinda API paths must be prefixed with /v3/.
    message: '{{path}} must start with /v3/'
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: '^/v3/'
  affinda-paths-must-be-snake-case:
    description: Affinda uses snake_case in path segments (e.g. /v3/document_types, /v3/resthook_subscriptions).
    message: Path segment {{value}} should be snake_case.
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: '^/(v3|[a-z0-9_]+)(/(\{[A-Za-z0-9_]+\}|[a-z0-9_]+))*$'
  affinda-must-use-bearer-or-apikey:
    description: Affinda accepts Bearer tokens via Authorization header.
    severity: error
    given: $.components.securitySchemes[*]
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            type:
              enum: [http, apiKey]
          required: [type]
  affinda-operations-must-have-tags:
    description: Every Affinda operation must declare at least one tag.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  affinda-operations-should-have-operationId:
    description: Operations should declare an operationId for SDK generation.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  affinda-summaries-should-be-title-case:
    description: Operation summaries should use Title Case.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][A-Za-z0-9 ()\-/&]+$'
  affinda-no-deprecated-tag-in-public-spec:
    description: Endpoints tagged "Deprecated End Points" should not be promoted to consumers.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].tags[*]
    then:
      function: pattern
      functionOptions:
        notMatch: 'Deprecated End Points'
  affinda-server-must-be-regional:
    description: The server URL must use the Affinda regional pattern.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://(api|api\.us1|api\.eu1|\{region\})\.affinda\.com'

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