Skip to content

basalt / admin/src / fieldsFromSchema

Function: fieldsFromSchema() ​

> fieldsFromSchema(schema, overrides?): Field[]

Defined in: admin/src/fields.ts:86

Derives field descriptors from a Zod object schema — the heart of the admin kit.

overrides is keyed by field name and applied to whichever schema is being described, so one map covers the table, the create form and the edit form. A key naming no field is ignored: a rename leaves a stale entry behind, and refusing to describe the resource over a leftover translation would be a poor trade.

Parameters ​

schema ​

ZodObject<Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }>>

overrides? ​

Record<string, FieldConfig> = {}

Returns ​

Field[]

Released under the MIT License.