tRPC · API Governance Rules

tRPC API Rules

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

8 Rules error 3 warn 2
View Rules File View on GitHub

Rule Categories

trpc

Rules

warn
trpc-operation-summary-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
error
trpc-operation-tags-required
All operations must have at least one tag
$.paths[*][*]
warn
trpc-trpc-error-schema
Error responses must use the TRPCErrorResult schema
$.paths[*][*].responses[4*,5*].content.application/json.schema
error
trpc-success-response-defined
All operations should define a 200 success response
$.paths[*][get,post]
hint
trpc-procedure-path-format
tRPC procedure paths should use dot notation for nested routers (e.g., router.procedure) or flat names for root procedures
$.paths[*]~
error
trpc-batch-endpoint-post
Batch endpoints must use POST method
$.paths[/batch]
hint
trpc-query-uses-get
Query procedures should use GET method
$.paths[*]~
hint
trpc-input-query-param
GET operations should define an input query parameter
$.paths[*][get]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  trpc-operation-summary-title-case:
    description: Operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-z]* ?)+$"

  trpc-operation-tags-required:
    description: All operations must have at least one tag
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  trpc-trpc-error-schema:
    description: Error responses must use the TRPCErrorResult schema
    severity: warn
    given: "$.paths[*][*].responses[4*,5*].content.application/json.schema"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1

  trpc-success-response-defined:
    description: All operations should define a 200 success response
    severity: error
    given: "$.paths[*][get,post]"
    then:
      field: responses
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1

  trpc-procedure-path-format:
    description: >-
      tRPC procedure paths should use dot notation for nested routers
      (e.g., router.procedure) or flat names for root procedures
    severity: hint
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-zA-Z0-9._-]+|/\\{procedure\\})$"

  trpc-batch-endpoint-post:
    description: Batch endpoints must use POST method
    severity: error
    given: "$.paths[/batch]"
    then:
      field: post
      function: truthy

  trpc-query-uses-get:
    description: Query procedures should use GET method
    severity: hint
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        notMatch: "^/batch$"

  trpc-input-query-param:
    description: GET operations should define an input query parameter
    severity: hint
    given: "$.paths[*][get]"
    then:
      field: parameters
      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/trpc-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 email required.

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