Skip to content

x-to-zod / registerAdapter

Function: registerAdapter()

ts
function registerAdapter(adapter): void;

Defined in: src/SchemaInput/index.ts:58

Register a SchemaInputAdapter as the process-wide default.

Global registration — affects all subsequent parseSchema / jsonSchemaToZod calls that do not supply a per-call adapter:

ts
import { registerAdapter } from 'x-to-zod';
import { MyAdapter } from './MyAdapter.js';

registerAdapter(new MyAdapter());

Per-call override — pass adapter in the Context / options object to override for a single invocation without touching the global state:

ts
const result = jsonSchemaToZod(mySchema, { adapter: new MyAdapter() });

Parameters

adapter

SchemaInputAdapter

The adapter to install as the global default.

Returns

void

Released under the ISC License.