Skip to content

Commit 123a9a4

Browse files
committed
fix: update Zod schemas to support optional parameters with defaults
1 parent 028136a commit 123a9a4

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

packages/spec/src/api/rest-server.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export const CrudEndpointsConfigSchema = z.object({
182182
/**
183183
* Custom endpoint patterns (override defaults)
184184
*/
185-
patterns: z.record(CrudOperation, CrudEndpointPatternSchema).optional()
185+
patterns: z.record(CrudOperation, CrudEndpointPatternSchema.optional()).optional()
186186
.describe('Custom URL patterns for operations'),
187187

188188
/**

packages/spec/src/system/plugin.zod.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,67 @@ import { z } from 'zod';
55
export const PluginContextSchema = z.object({
66
ql: z.object({
77
object: z.function({
8-
input: z.tuple([]),
8+
input: z.tuple([]).rest(z.any()),
99
output: z.any()
1010
}), // Return any to allow method chaining
1111
query: z.function({
12-
input: z.tuple([]),
12+
input: z.tuple([]).rest(z.any()),
1313
output: z.any()
1414
}),
1515
}).passthrough().describe('ObjectQL Engine Interface'),
1616

1717
os: z.object({
1818
getCurrentUser: z.function({
19-
input: z.tuple([]),
19+
input: z.tuple([]).rest(z.any()),
2020
output: z.any()
2121
}),
2222
getConfig: z.function({
23-
input: z.tuple([]),
23+
input: z.tuple([]).rest(z.any()),
2424
output: z.any()
2525
}),
2626
}).passthrough().describe('ObjectStack Kernel Interface'),
2727

2828
logger: z.object({
2929
debug: z.function({
30-
input: z.tuple([]),
30+
input: z.tuple([]).rest(z.any()),
3131
output: z.void()
3232
}),
3333
info: z.function({
34-
input: z.tuple([]),
34+
input: z.tuple([]).rest(z.any()),
3535
output: z.void()
3636
}),
3737
warn: z.function({
38-
input: z.tuple([]),
38+
input: z.tuple([]).rest(z.any()),
3939
output: z.void()
4040
}),
4141
error: z.function({
42-
input: z.tuple([]),
42+
input: z.tuple([]).rest(z.any()),
4343
output: z.void()
4444
}),
4545
}).passthrough().describe('Logger Interface'),
4646

4747
storage: z.object({
4848
get: z.function({
49-
input: z.tuple([]),
49+
input: z.tuple([]).rest(z.any()),
5050
output: z.any()
5151
}),
5252
set: z.function({
53-
input: z.tuple([]),
53+
input: z.tuple([]).rest(z.any()),
5454
output: z.promise(z.void())
5555
}),
5656
delete: z.function({
57-
input: z.tuple([]),
57+
input: z.tuple([]).rest(z.any()),
5858
output: z.promise(z.void())
5959
}),
6060
}).passthrough().describe('Storage Interface'),
6161

6262
i18n: z.object({
6363
t: z.function({
64-
input: z.tuple([]),
64+
input: z.tuple([]).rest(z.any()),
6565
output: z.string()
6666
}),
6767
getLocale: z.function({
68-
input: z.tuple([]),
68+
input: z.tuple([]).rest(z.any()),
6969
output: z.string()
7070
}),
7171
}).passthrough().describe('Internationalization Interface'),
@@ -76,23 +76,23 @@ export const PluginContextSchema = z.object({
7676
app: z.object({
7777
router: z.object({
7878
get: z.function({
79-
input: z.tuple([]),
79+
input: z.tuple([]).rest(z.any()),
8080
output: z.any()
8181
}),
8282
post: z.function({
83-
input: z.tuple([]),
83+
input: z.tuple([]).rest(z.any()),
8484
output: z.any()
8585
}),
8686
use: z.function({
87-
input: z.tuple([]),
87+
input: z.tuple([]).rest(z.any()),
8888
output: z.any()
8989
}),
9090
}).passthrough()
9191
}).passthrough().describe('App Framework Interface'),
9292

9393
drivers: z.object({
9494
register: z.function({
95-
input: z.tuple([]),
95+
input: z.tuple([]).rest(z.any()),
9696
output: z.void()
9797
}),
9898
}).passthrough().describe('Driver Registry'),

packages/spec/src/system/tracing.zod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,12 @@ export const TracingConfigSchema = z.object({
629629
/**
630630
* Sampling configuration
631631
*/
632-
sampling: TraceSamplingConfigSchema.optional(),
632+
sampling: TraceSamplingConfigSchema.optional().default({ type: 'always_on', rules: [] }),
633633

634634
/**
635635
* Context propagation
636636
*/
637-
propagation: TraceContextPropagationSchema.optional(),
637+
propagation: TraceContextPropagationSchema.optional().default({ formats: ['w3c'], extract: true, inject: true }),
638638

639639
/**
640640
* OpenTelemetry configuration

0 commit comments

Comments
 (0)