Sound Transit · API Governance Rules

Sound Transit API Rules

Spectral linting rules defining API design standards and conventions for Sound Transit.

10 Rules error 2 warn 7 info 1
View Rules File View on GitHub

Rule Categories

sound

Rules

error
sound-transit-api-key-required
All Sound Transit API operations require the 'key' query parameter
$.paths[*][get].parameters[?(@.name == 'key')]
warn
sound-transit-json-suffix
Sound Transit OneBusAway API paths use .json suffix
$.paths
warn
sound-transit-operation-summary-title-case
Operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete].summary
error
sound-transit-operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
sound-transit-operation-id-camel-case
OperationId must use camelCase convention
$.paths[*][get,post,put,patch,delete].operationId
warn
sound-transit-operation-has-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
sound-transit-401-response
Operations must document 401 Unauthorized for invalid API key
$.paths[*][get,post,put,patch,delete].responses
warn
sound-transit-response-schema-defined
Successful responses must have a schema
$.paths[*][get].responses['200'].content['application/json']
warn
sound-transit-tags-title-case
All tags in the spec must use Title Case
$.tags[*].name
info
sound-transit-base-response-structure
All response schemas should reference BaseResponse or include code and currentTime fields
$.components.schemas.BaseResponse

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Sound Transit OneBusAway API always requires API key query parameter
  sound-transit-api-key-required:
    description: All Sound Transit API operations require the 'key' query parameter
    severity: error
    given: "$.paths[*][get].parameters[?(@.name == 'key')]"
    then:
      field: required
      function: truthy

  # All paths use .json suffix - enforce this pattern
  sound-transit-json-suffix:
    description: Sound Transit OneBusAway API paths use .json suffix
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: ".*\\.json$"

  # All operations must have summaries in Title Case
  sound-transit-operation-summary-title-case:
    description: Operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"

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

  # operationId must use camelCase
  sound-transit-operation-id-camel-case:
    description: OperationId must use camelCase convention
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  # All operations must have tags
  sound-transit-operation-has-tags:
    description: All operations must have at least one tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  # 401 response for missing API key
  sound-transit-401-response:
    description: Operations must document 401 Unauthorized for invalid API key
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      field: "401"
      function: defined

  # Response schemas must be defined
  sound-transit-response-schema-defined:
    description: Successful responses must have a schema
    severity: warn
    given: "$.paths[*][get].responses['200'].content['application/json']"
    then:
      field: schema
      function: defined

  # All tags must be Title Case
  sound-transit-tags-title-case:
    description: All tags in the spec must use Title Case
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"

  # BaseResponse structure - all responses inherit from BaseResponse
  sound-transit-base-response-structure:
    description: All response schemas should reference BaseResponse or include code and currentTime fields
    severity: info
    given: "$.components.schemas.BaseResponse"
    then:
      field: properties
      function: truthy

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/sound-transit-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.