We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b5bc43b commit 2c444bfCopy full SHA for 2c444bf
1 file changed
packages/core/src/api-registry.ts
@@ -7,6 +7,7 @@ import type {
7
ApiDiscoveryQuery,
8
ApiDiscoveryResponse,
9
} from '@objectstack/spec/api';
10
+import { ApiRegistryEntrySchema } from '@objectstack/spec/api';
11
import type { Logger } from '@objectstack/spec/contracts';
12
13
/**
@@ -80,8 +81,8 @@ export class ApiRegistry {
80
81
throw new Error(`[ApiRegistry] API '${api.id}' already registered`);
82
}
83
- // Cast to full type after validation
84
- const fullApi = api as ApiRegistryEntry;
+ // Parse and validate the input using Zod schema
85
+ const fullApi = ApiRegistryEntrySchema.parse(api);
86
87
// Validate and register endpoints
88
for (const endpoint of fullApi.endpoints) {
0 commit comments