Skip to content
oRPC
Esc
navigateopen⌘Jpreview
On this page

ArkType Integration

ArkType implements Standard Schema, so you can use it directly in your procedures without any extra setup. On top of that, @orpc/arktype provides a dedicated JSON Schema converter.

Installation

npm install @orpc/arktype@beta arktype
pnpm add @orpc/arktype@beta arktype
yarn add @orpc/arktype@beta arktype
bun add @orpc/arktype@beta arktype

JSON Schema Converter

ArkTypeToJsonSchemaConverter wraps ArkType’s built-in toJsonSchema and adds support for additional types such as bigint and Date. Use it with tools such as the OpenAPI Generator and Smart Coercion. It accepts the same options as ArkType’s toJsonSchema, see the source code and ArkType’s JSON Schema configuration docs for implementation details.

import { OpenAPIGenerator } from '@orpc/openapi'
import { ArkTypeToJsonSchemaConverter } from '@orpc/arktype'

const generator = new OpenAPIGenerator({
  converters: [new ArkTypeToJsonSchemaConverter()],
})

Reusable Types

A common pattern is defining reusable or recursive types using scopes. The converter preserves them in $defs, which OpenAPIGenerator can then hoist into components.schemas.

import { scope } from 'arktype'

const types = scope({
  Planet: {
    name: 'string',
    neighbors: 'Planet[]',
  },
})

const PlanetSchema = types.export().Planet

Last updated on August 6, 2026

Was this page helpful?