TransportAPI · API Governance Rules

TransportAPI API Rules

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

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

Rule Categories

transportapi

Rules

warn
transportapi-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
error
transportapi-operationid-required
All operations must have an operationId
$.paths[*][*]
warn
transportapi-tags-required
All operations must have tags
$.paths[*][*]
hint
transportapi-json-extension-in-paths
UK transport endpoints should end with .json extension
$.paths
error
transportapi-response-200-required
All GET operations must have a 200 response
$.paths[*].get.responses
warn
transportapi-app-auth-params
API authentication via app_id and app_key query parameters must be documented
$.components.securitySchemes
info
transportapi-uk-base-path
All paths should operate under UK data context
$.servers[*].url
hint
transportapi-atcocode-path-param
Bus stop path parameters should be named atcocode
$.paths[*][*].parameters[*][?(@.in=='path' && @.name=='station_stop')]
warn
transportapi-datetime-format
Date-time properties should use ISO 8601 format
$.components.schemas[*].properties[?(@.format=='date-time')]
hint
transportapi-pagination-limit
Collection endpoints should support limit parameter
$.paths[*].get.parameters[*][?(@.name=='limit')]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  transportapi-operation-summary-title-case:
    description: All operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z]*(\\s[A-Z][a-zA-Z]*)*$"

  transportapi-operationid-required:
    description: All operations must have an operationId
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: truthy

  transportapi-tags-required:
    description: All operations must have tags
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  transportapi-json-extension-in-paths:
    description: UK transport endpoints should end with .json extension
    severity: hint
    given: "$.paths"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            ".*\\.json$": {}

  transportapi-response-200-required:
    description: All GET operations must have a 200 response
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: truthy

  transportapi-app-auth-params:
    description: API authentication via app_id and app_key query parameters must be documented
    severity: warn
    given: "$.components.securitySchemes"
    then:
      function: truthy

  transportapi-uk-base-path:
    description: All paths should operate under UK data context
    severity: info
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: ".*transportapi\\.com.*"

  transportapi-atcocode-path-param:
    description: Bus stop path parameters should be named atcocode
    severity: hint
    given: "$.paths[*][*].parameters[*][?(@.in=='path' && @.name=='station_stop')]"
    then:
      function: falsy

  transportapi-datetime-format:
    description: Date-time properties should use ISO 8601 format
    severity: warn
    given: "$.components.schemas[*].properties[?(@.format=='date-time')]"
    then:
      field: format
      function: enumeration
      functionOptions:
        values:
          - date-time

  transportapi-pagination-limit:
    description: Collection endpoints should support limit parameter
    severity: hint
    given: "$.paths[*].get.parameters[*][?(@.name=='limit')]"
    then:
      field: schema
      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/transportapi-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.