oRPC OpenAPI to Contract
Generate an oRPC contract from an existing OpenAPI specification with Hey API.
Файлы2
Открыть в GitHubSKILL.mdskills/orpc-openapi-to-contract/SKILL.md
GitHubOpenAPI to Contract
If you have an OpenAPI Specification, use Hey API's orpc plugin to generate an oRPC contract.
The Hey API
orpcplugin is currently beta.
Example
npm install -D @hey-api/openapi-ts
// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts'
export default defineConfig({
input: 'https://get.heyapi.dev/hey-api/backend',
output: 'src/client',
plugins: [
{
name: 'orpc',
validator: { input: 'zod' },
},
],
})
Then run:
npx @hey-api/openapi-ts
What To Do Next
- Implement the contract on your own server with Implement Contract.
- Create a type-safe client with OpenAPILink.
- Use as reference alongside Define Contract.