orpc-openapi

Expose an oRPC router as a spec-compliant OpenAPI HTTP API.

1|Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Chia1104/agent-air --skill orpc-openapi-chia1104
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: orpc-openapi
Source: https://github.com/Chia1104/agent-air/tree/main/skills/shared/orpc-openapi
Command: npx skills add https://github.com/Chia1104/agent-air --skill orpc-openapi-chia1104

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript teams using oRPC v2 often need to expose their procedures as plain REST-style HTTP endpoints and generate OpenAPI documentation, but pretrained knowledge describes the outdated v1 API and leads to incorrect implementations. ## Core Features & Use Cases - REST Routing on oRPC Procedures: Define HTTP methods and paths with openapi() metadata or the .route extension, including path params, prefixes, and success statuses. - Serving and Calling: Serve routers with OpenAPIHandler alongside RPCHandler, coerce string query/path values with Smart Coercion, and call OpenAPI-shaped APIs typesafely with OpenAPILink. - Spec Generation and Docs: Generate OpenAPI 3.2 (or 3.1/3.0) documents with OpenAPIGenerator and serve Scalar or Swagger UIs via the OpenAPI Reference plugin. - Use Case: You have an oRPC router for a planets API and need a public REST interface. Attach GET /planets/{id} routes with openapi metadata, mount OpenAPIHandler at /api next to RPCHandler at /rpc, and serve an interactive Scalar docs page with a generated spec. ## Quick Start Use the orpc-openapi skill to expose my oRPC router as REST endpoints under /api and generate an OpenAPI spec with Scalar docs.

Frequently Asked Questions about orpc-openapi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose oRPC procedures as REST API endpoints?▼

Attach openapi metadata from @orpc/openapi to each procedure, setting method, path, and successStatus, then serve the router with OpenAPIHandler from an adapter subpath like @orpc/openapi/fetch. Path params use {id} syntax matching required input schema fields.

How to generate an OpenAPI spec from an oRPC router?▼

Use OpenAPIGenerator from @orpc/openapi with a schema converter such as ZodToJsonSchemaConverter, calling generate with your router and a base document containing info and servers. It produces OpenAPI 3.2 by default and accepts a version option for 3.1 or 3.0.

Can OpenAPIHandler and RPCHandler run on the same oRPC router?▼

Yes, both handlers accept the same router. Mount them on different prefixes such as /api and /rpc, try each handler in turn, and return the first response whose matched flag is true.

Why are my oRPC query parameters arriving as strings?▼

Query, path, and form values always arrive as strings over HTTP. Add SmartCoercionHandlerPlugin from @orpc/json-schema with your schema converters to perform lossless coercions like '123' to 123 or ISO strings to Date.

What are the limitations of oRPC bracket notation for query strings?▼

Bracket notation cannot represent empty objects or arrays, root-level arrays, or objects whose keys are all numbers. Repeated keys and color[]= syntax build arrays, while [key] builds nested objects, and all values remain strings.

When should I use the orpc-contract skill instead of orpc-openapi?▼

Use orpc-contract for contract-first workflows: defining contracts with oc from @orpc/contract, implementing them with implement, shipping minified JSON contracts, or generating a contract from an existing OpenAPI spec. Use orpc-openapi for serving and documenting the REST side.