getCollectionInputSchema
getCollectionInputSchema(
props):ZodObject<{[key:string]:ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>; },$strip>
Defined in: packages/core/src/collections/utils.ts:65
Builds a Zod object schema for validating all fields in a collection.
Calls adminFieldToInputSchema for each field and combines the results
into a z.object({...}). Used by useCollectionForm as the TanStack Form
onSubmitAsync / onBlurAsync validator.
Parameters
Section titled “Parameters”Input props.
collection
Section titled “collection”The collection whose fields define the schema shape.
Returns
Section titled “Returns”ZodObject<{[key: string]: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }, $strip>
A z.object schema with one key per collection field.
Example
Section titled “Example”const schema = getCollectionInputSchema({ collection: postsCollection })// → z.object({ title: z.string().min(1), slug: z.string().min(3).max(100) })schema.parse({ title: "Hello", slug: "hello" }) // passes