diff --git a/packages/spec/src/shared/error-map.zod.ts b/packages/spec/src/shared/error-map.zod.ts index 617a71f83b..2eb33ee956 100644 --- a/packages/spec/src/shared/error-map.zod.ts +++ b/packages/spec/src/shared/error-map.zod.ts @@ -5,21 +5,9 @@ import { suggestFieldType, formatSuggestion, findClosestMatches } from './sugges import { FieldType } from '../data/field.zod'; /** - * Zod v4 raw issue structure (subset used by the error map). + * Zod v4 raw issue type used by the error map. */ -export interface ObjectStackRawIssue { - code: string; - path?: (string | number)[]; - input?: unknown; - values?: unknown[]; - origin?: string; - minimum?: number; - maximum?: number; - expected?: string; - format?: string; - keys?: string[]; - [key: string]: unknown; -} +export type ObjectStackRawIssue = z.core.$ZodRawIssue; /** * ObjectStack Custom Zod Error Map @@ -142,7 +130,7 @@ export const objectStackErrorMap = (issue: ObjectStackRawIssue): { message: stri * Zod Issue interface (subset needed for formatting). */ interface ZodIssueMinimal { - path: (string | number)[]; + path: PropertyKey[]; message: string; code?: string; } diff --git a/packages/spec/src/stack.zod.ts b/packages/spec/src/stack.zod.ts index df17d59863..78c89afba2 100644 --- a/packages/spec/src/stack.zod.ts +++ b/packages/spec/src/stack.zod.ts @@ -266,10 +266,15 @@ function validateCrossReferences(config: ObjectStackDefinition): string[] { // Validate hook → object references if (config.hooks) { for (const hook of config.hooks) { - if (hook.object && !objectNames.has(hook.object)) { - errors.push( - `Hook '${hook.name}' references object '${hook.object}' which is not defined in objects.`, - ); + if (hook.object) { + const hookObjects = Array.isArray(hook.object) ? hook.object : [hook.object]; + for (const obj of hookObjects) { + if (!objectNames.has(obj)) { + errors.push( + `Hook '${hook.name}' references object '${obj}' which is not defined in objects.`, + ); + } + } } } }