Skip to content

Commit a590c96

Browse files
authored
Merge pull request #649 from objectstack-ai/copilot/fix-build-and-test-yet-again
2 parents 1fc6eff + 6d8a755 commit a590c96

2 files changed

Lines changed: 12 additions & 19 deletions

File tree

packages/spec/src/shared/error-map.zod.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,9 @@ import { suggestFieldType, formatSuggestion, findClosestMatches } from './sugges
55
import { FieldType } from '../data/field.zod';
66

77
/**
8-
* Zod v4 raw issue structure (subset used by the error map).
8+
* Zod v4 raw issue type used by the error map.
99
*/
10-
export interface ObjectStackRawIssue {
11-
code: string;
12-
path?: (string | number)[];
13-
input?: unknown;
14-
values?: unknown[];
15-
origin?: string;
16-
minimum?: number;
17-
maximum?: number;
18-
expected?: string;
19-
format?: string;
20-
keys?: string[];
21-
[key: string]: unknown;
22-
}
10+
export type ObjectStackRawIssue = z.core.$ZodRawIssue;
2311

2412
/**
2513
* ObjectStack Custom Zod Error Map
@@ -142,7 +130,7 @@ export const objectStackErrorMap = (issue: ObjectStackRawIssue): { message: stri
142130
* Zod Issue interface (subset needed for formatting).
143131
*/
144132
interface ZodIssueMinimal {
145-
path: (string | number)[];
133+
path: PropertyKey[];
146134
message: string;
147135
code?: string;
148136
}

packages/spec/src/stack.zod.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,15 @@ function validateCrossReferences(config: ObjectStackDefinition): string[] {
266266
// Validate hook → object references
267267
if (config.hooks) {
268268
for (const hook of config.hooks) {
269-
if (hook.object && !objectNames.has(hook.object)) {
270-
errors.push(
271-
`Hook '${hook.name}' references object '${hook.object}' which is not defined in objects.`,
272-
);
269+
if (hook.object) {
270+
const hookObjects = Array.isArray(hook.object) ? hook.object : [hook.object];
271+
for (const obj of hookObjects) {
272+
if (!objectNames.has(obj)) {
273+
errors.push(
274+
`Hook '${hook.name}' references object '${obj}' which is not defined in objects.`,
275+
);
276+
}
277+
}
273278
}
274279
}
275280
}

0 commit comments

Comments
 (0)