tRPC · Schema

tRPC Procedure

A tRPC procedure definition (query, mutation, or subscription)

API CompositionAPI FrameworkBFFEnd-to-End Type SafetyRPCTypeScript

Properties

Name Type Description
type string The procedure type
path string Dot-notation procedure path (e.g., 'user.getUser')
meta object Procedure metadata, including OpenAPI mapping when using trpc-openapi
View JSON Schema on GitHub

JSON Schema

trpc-procedure-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trpc.io/schemas/procedure",
  "title": "tRPC Procedure",
  "description": "A tRPC procedure definition (query, mutation, or subscription)",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": ["query", "mutation", "subscription"],
      "description": "The procedure type"
    },
    "path": {
      "type": "string",
      "description": "Dot-notation procedure path (e.g., 'user.getUser')",
      "pattern": "^[a-zA-Z][a-zA-Z0-9]*(\\.[a-zA-Z][a-zA-Z0-9]*)*$"
    },
    "meta": {
      "type": "object",
      "description": "Procedure metadata, including OpenAPI mapping when using trpc-openapi",
      "properties": {
        "openapi": {
          "type": "object",
          "description": "OpenAPI metadata for REST exposure via trpc-openapi",
          "properties": {
            "method": {
              "type": "string",
              "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"]
            },
            "path": {
              "type": "string",
              "description": "REST path pattern"
            },
            "protect": {
              "type": "boolean",
              "description": "Whether the endpoint requires authentication"
            },
            "summary": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "tags": {
              "type": "array",
              "items": { "type": "string" }
            }
          },
          "required": ["method", "path"]
        }
      }
    }
  },
  "required": ["type", "path"],
  "additionalProperties": false
}