Skip to content

uploadFieldToInputSchema

uploadFieldToInputSchema(props): ZodType

Defined in: packages/core/src/fields/upload/inputSchema.ts:27

Generates the Zod input schema for an upload field.

The form stores an array of media document ID strings. The upload component validates that each ID points to an existing media document at the UI level (by querying the media collection); the Zod schema only checks shape and, for required fields, non-emptiness. Required fields attach { error: "This field is required." } to the base z.array() call and add .min(1, "This field is required.") — previously a required upload field had zero length enforcement and accepted [] (CORE-1).

field.min/field.max (file-count constraints) are independent of required: required governs whether the field may be empty, min/max govern the file count once a value is supplied. An empty array always skips both checks; a non-empty array — required or not — is always checked against a configured min/max.

— Input schema generation options.

UploadField

— The resolved upload field definition.

ZodType

Zod schema for the form field value.