Skip to content

Commit 6df1c78

Browse files
Copilothotlong
andcommitted
fix: apply 7 bug fixes for schema correctness (Phase 1)
1.1 Replace z.any() with z.function() in hook handler union 1.2 Fix ValidationRuleSchema inferring as any with proper base type 1.3 Fix invalid computed key syntax in AuthConfigSchema with .catchall() 1.4 Fix MongoDriverSpec capability key mismatches 1.5 Fix DatasourceConfig type alias naming 1.6 Replace z.instanceof(Error) with JSON-serializable error shape 1.7 Fix filter operator typo $exist → $exists Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 85bb921 commit 6df1c78

20 files changed

Lines changed: 134 additions & 44 deletions

packages/spec/json-schema/data/FieldOperators.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"$null": {
176176
"type": "boolean"
177177
},
178-
"$exist": {
178+
"$exists": {
179179
"type": "boolean"
180180
}
181181
},

packages/spec/json-schema/data/Hook.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@
5858
"anyOf": [
5959
{
6060
"type": "string"
61-
},
62-
{}
61+
}
6362
],
64-
"description": "Function handler name or direct function"
63+
"description": "Handler function name (string) or inline function reference"
6564
},
6665
"priority": {
6766
"type": "number",

packages/spec/json-schema/data/NormalizedFilter.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
"$null": {
185185
"type": "boolean"
186186
},
187-
"$exist": {
187+
"$exists": {
188188
"type": "boolean"
189189
}
190190
},
@@ -375,7 +375,7 @@
375375
"$null": {
376376
"type": "boolean"
377377
},
378-
"$exist": {
378+
"$exists": {
379379
"type": "boolean"
380380
}
381381
},
@@ -564,7 +564,7 @@
564564
"$null": {
565565
"type": "boolean"
566566
},
567-
"$exist": {
567+
"$exists": {
568568
"type": "boolean"
569569
}
570570
},

packages/spec/json-schema/data/SpecialOperator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"$null": {
88
"type": "boolean"
99
},
10-
"$exist": {
10+
"$exists": {
1111
"type": "boolean"
1212
}
1313
},

packages/spec/json-schema/kernel/PluginErrorEvent.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,31 @@
1313
"description": "Unix timestamp in milliseconds when event occurred"
1414
},
1515
"error": {
16-
"description": "Error object"
16+
"type": "object",
17+
"properties": {
18+
"name": {
19+
"type": "string",
20+
"description": "Error class name"
21+
},
22+
"message": {
23+
"type": "string",
24+
"description": "Error message"
25+
},
26+
"stack": {
27+
"type": "string",
28+
"description": "Stack trace"
29+
},
30+
"code": {
31+
"type": "string",
32+
"description": "Error code"
33+
}
34+
},
35+
"required": [
36+
"name",
37+
"message"
38+
],
39+
"additionalProperties": false,
40+
"description": "Serializable error representation"
1741
},
1842
"phase": {
1943
"type": "string",

packages/spec/json-schema/kernel/PluginStartupResult.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,31 @@
3030
"description": "Time taken to start the plugin in milliseconds"
3131
},
3232
"error": {
33-
"description": "Error object if startup failed"
33+
"type": "object",
34+
"properties": {
35+
"name": {
36+
"type": "string",
37+
"description": "Error class name"
38+
},
39+
"message": {
40+
"type": "string",
41+
"description": "Error message"
42+
},
43+
"stack": {
44+
"type": "string",
45+
"description": "Stack trace"
46+
},
47+
"code": {
48+
"type": "string",
49+
"description": "Error code"
50+
}
51+
},
52+
"required": [
53+
"name",
54+
"message"
55+
],
56+
"additionalProperties": false,
57+
"description": "Serializable error representation if startup failed"
3458
},
3559
"health": {
3660
"type": "object",

packages/spec/json-schema/kernel/StartupOrchestrationResult.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,31 @@
3535
"description": "Time taken to start the plugin in milliseconds"
3636
},
3737
"error": {
38-
"description": "Error object if startup failed"
38+
"type": "object",
39+
"properties": {
40+
"name": {
41+
"type": "string",
42+
"description": "Error class name"
43+
},
44+
"message": {
45+
"type": "string",
46+
"description": "Error message"
47+
},
48+
"stack": {
49+
"type": "string",
50+
"description": "Stack trace"
51+
},
52+
"code": {
53+
"type": "string",
54+
"description": "Error code"
55+
}
56+
},
57+
"required": [
58+
"name",
59+
"message"
60+
],
61+
"additionalProperties": false,
62+
"description": "Serializable error representation if startup failed"
3963
},
4064
"health": {
4165
"type": "object",

packages/spec/json-schema/system/AuthConfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@
9090
}
9191
},
9292
"additionalProperties": false
93-
},
94-
"[object Object]": {}
93+
}
9594
},
96-
"additionalProperties": false
95+
"additionalProperties": {}
9796
}
9897
},
9998
"$schema": "http://json-schema.org/draft-07/schema#"

packages/spec/src/data/datasource.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
DriverDefinitionSchema,
66
DriverType,
77
type Datasource,
8-
type DatasourceConfig,
8+
type DatasourceCapabilitiesType,
99
} from './datasource.zod';
1010

1111
describe('DriverType', () => {

packages/spec/src/data/datasource.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ export const DatasourceSchema = z.object({
138138
});
139139

140140
export type Datasource = z.infer<typeof DatasourceSchema>;
141-
export type DatasourceConfig = z.infer<typeof DatasourceCapabilities>;
141+
export type DatasourceCapabilitiesType = z.infer<typeof DatasourceCapabilities>;

0 commit comments

Comments
 (0)