fix: AutoFromFieldObject not utilising base schema (#526)

This commit is contained in:
Michael DeGiovanni 2024-05-06 09:22:02 +02:00 committed by GitHub
parent 9dfb0b86c0
commit e67c98b485
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,8 @@ const shapes = computed(() => {
return return
Object.keys(shape).forEach((name) => { Object.keys(shape).forEach((name) => {
const item = shape[name] as ZodAny const item = shape[name] as ZodAny
let options = 'values' in item._def ? item._def.values as string[] : undefined const baseItem = getBaseSchema(item) as ZodAny
let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined
if (!Array.isArray(options) && typeof options === 'object') if (!Array.isArray(options) && typeof options === 'object')
options = Object.values(options) options = Object.values(options)

View File

@ -28,7 +28,8 @@ const shapes = computed(() => {
return return
Object.keys(shape).forEach((name) => { Object.keys(shape).forEach((name) => {
const item = shape[name] as ZodAny const item = shape[name] as ZodAny
let options = 'values' in item._def ? item._def.values as string[] : undefined const baseItem = getBaseSchema(item) as ZodAny
let options = (baseItem && 'values' in baseItem._def) ? baseItem._def.values as string[] : undefined
if (!Array.isArray(options) && typeof options === 'object') if (!Array.isArray(options) && typeof options === 'object')
options = Object.values(options) options = Object.values(options)