Skip to main content

Variable: zodAdapter

const zodAdapter: SchemaAdapter

Defined in: packages/core/src/adapters/zodAdapter.ts:31

The shipped SchemaAdapter — what defineCatalog resolves hint paths through, exported so an editing surface can describe a block's fields without loading the block's component.

It is named for the reference validator but reads any schema exposing the Standard JSON Schema converter, richText() included.

Example

zodAdapter.describe(z.object({ title: z.string(), draft: z.boolean().optional() }));
// [
// { path: "title", kind: "string", optional: false },
// { path: "draft", kind: "boolean", optional: true },
// ]

zodAdapter.describe(z.object({ items: z.array(z.object({ title: z.string() })) }))
.map((field) => field.path);
// ["items", "items[]", "items[].title"]

zodAdapter.describe(z.object({ tone: z.enum(["light", "dark"]) }));
// [{ path: "tone", kind: "enum", optional: false, members: ["light", "dark"] }]