Skip to content

jsonFieldToInputSchema

jsonFieldToInputSchema(props): ZodType

Defined in: packages/core/src/fields/json/inputSchema.ts:25

Builds a Zod schema for validating a json field value in the admin form.

There is no shape validation — any JSON-serializable value passes. A required field rejects undefined/null with “This field is required.”; a non-required field accepts a missing value and falls back to field.defaultValue.

Input props.

JsonField

The resolved json field definition

ZodType

A Zod schema accepting any defined, non-null value when required

const field = json({ required: true })
jsonFieldToInputSchema({ field })
// → z.unknown().refine(...) — rejects undefined/null with "This field is required."