textFieldToInputSchema
textFieldToInputSchema(
props):ZodType
Defined in: packages/core/src/fields/text/inputSchema.ts:23
Builds a Zod schema for validating a text field value in the admin form.
Applies min/max character-length constraints when configured, then
wraps in .optional() for non-required fields via applyBaseInputSchemaMeta.
Parameters
Section titled “Parameters”Input props.
The resolved text field definition
Returns
Section titled “Returns”ZodType
A Zod string schema with length constraints, a baked-in .default(field.defaultValue), and optionality applied
Example
Section titled “Example”const field = text({ required: true, min: { value: 3 }, max: { value: 100 } })textFieldToInputSchema({ field })// → z.string().min(3).max(100).default("")// (a configured `min` supersedes the bare `.min(1)` required check)