The SchemaConverter interface
strategy— whether to convert the schema for an input (request body) or output (response body). This matters for schemas that transform data between input and output.components— a list of registered$refcomponents fromcommonSchemas. The converter should emit{ $ref: ... }when a schema matches a component.minStructureDepthForRef— the minimum depth at which$refsubstitution is allowed.
[required, jsonSchema]:
required(boolean) — whether this schema represents a required/non-optional valuejsonSchema— the JSON Schema representation
ConditionalSchemaConverter
Most converters implement ConditionalSchemaConverter, which adds a condition method:
condition method returns true when the converter can handle the given schema. This is how CompositeSchemaConverter picks the right converter for each schema.
CompositeSchemaConverter
CompositeSchemaConverter tries each registered converter in order and delegates to the first one whose condition returns true.
[false, {}] (an empty JSON Schema, meaning any value is accepted).
Mixing multiple schema libraries
condition.
Built-in converters
ZodToJsonSchemaConverter
From
@orpc/zod or @orpc/zod/zod4. Supports Zod v3 and v4.experimental_ValibotToJsonSchemaConverter
From
@orpc/valibot. Wraps @valibot/to-json-schema.experimental_ArkTypeToJsonSchemaConverter
From
@orpc/arktype. Uses ArkType’s built-in toJsonSchema().Writing a custom converter
To support a schema library not covered by the built-ins, implementConditionalSchemaConverter:
OpenAPIGenerator:
The
condition method receives the raw schema object. The ~standard property is the Standard Schema interface — vendor identifies the schema library.