Skip to content

Commit 7e9cbc3

Browse files
mattpodwysockigithub-actions[bot]claude
authored
chore: upgrade zod from v3 to v4 (#99)
* chore: bump version to 0.6.0 * chore: upgrade zod from v3 to v4 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8984c4f commit 7e9cbc3

18 files changed

Lines changed: 49 additions & 32 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Unreleased
22

3+
### Dependencies
4+
5+
- **Upgrade `zod` from `^3.25.42` to `^4.3.6`** — migrated all `z.record()` calls to require explicit key schema (`z.string()`), updated test assertions for changed error message format
6+
37
## 0.6.0 - 2026-04-01
48

59
### Security

‎package-lock.json‎

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@opentelemetry/sdk-node": "^0.56.0",
6161
"@opentelemetry/sdk-trace-base": "^1.30.1",
6262
"@opentelemetry/semantic-conventions": "^1.30.1",
63-
"zod": "^3.25.42"
63+
"zod": "^4.3.6"
6464
},
6565
"devDependencies": {
6666
"@eslint/js": "^9.27.0",

‎src/schemas/style.ts‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const LightsSchema = z.array(
2828
z.object({
2929
id: z.string(),
3030
type: z.enum(['ambient', 'directional']),
31-
properties: z.record(z.any()).optional()
31+
properties: z.record(z.string(), z.any()).optional()
3232
})
3333
);
3434

@@ -48,7 +48,7 @@ const VectorSourceSchema = z.object({
4848
minzoom: z.number().min(0).max(22).optional(),
4949
maxzoom: z.number().min(0).max(22).optional(),
5050
attribution: z.string().optional(),
51-
promoteId: z.union([z.string(), z.record(z.string())]).optional(),
51+
promoteId: z.union([z.string(), z.record(z.string(), z.string())]).optional(),
5252
volatile: z.boolean().optional()
5353
});
5454

@@ -88,10 +88,10 @@ const GeoJSONSourceSchema = z.object({
8888
cluster: z.boolean().optional(),
8989
clusterRadius: z.number().optional(),
9090
clusterMaxZoom: z.number().optional(),
91-
clusterProperties: z.record(z.any()).optional(),
91+
clusterProperties: z.record(z.string(), z.any()).optional(),
9292
lineMetrics: z.boolean().optional(),
9393
generateId: z.boolean().optional(),
94-
promoteId: z.union([z.string(), z.record(z.string())]).optional()
94+
promoteId: z.union([z.string(), z.record(z.string(), z.string())]).optional()
9595
});
9696

9797
const ImageSourceSchema = z.object({
@@ -156,17 +156,17 @@ const LayerSchema = z.object({
156156
minzoom: z.number().min(0).max(24).optional(),
157157
maxzoom: z.number().min(0).max(24).optional(),
158158
filter: z.any().optional().describe('Expression for filtering features'),
159-
layout: z.record(z.any()).optional(),
160-
paint: z.record(z.any()).optional(),
161-
metadata: z.record(z.any()).optional(),
159+
layout: z.record(z.string(), z.any()).optional(),
160+
paint: z.record(z.string(), z.any()).optional(),
161+
metadata: z.record(z.string(), z.any()).optional(),
162162
slot: z.string().optional().describe('Slot this layer is assigned to')
163163
});
164164

165165
// Style import schema
166166
const StyleImportSchema = z.object({
167167
id: z.string(),
168168
url: z.string(),
169-
config: z.record(z.any()).optional()
169+
config: z.record(z.string(), z.any()).optional()
170170
});
171171

172172
// Base Style properties (shared between input and output)
@@ -175,12 +175,14 @@ export const BaseStylePropertiesSchema = z.object({
175175
version: z
176176
.literal(8)
177177
.describe('Style specification version number. Must be 8'),
178-
sources: z.record(SourceSchema).describe('Data source specifications'),
178+
sources: z
179+
.record(z.string(), SourceSchema)
180+
.describe('Data source specifications'),
179181
layers: z.array(LayerSchema).describe('Layers in draw order'),
180182

181183
// Optional Style Spec properties
182184
metadata: z
183-
.record(z.any())
185+
.record(z.string(), z.any())
184186
.optional()
185187
.describe('Arbitrary properties for tracking'),
186188
center: CoordinatesSchema.optional().describe(
@@ -203,9 +205,13 @@ export const BaseStylePropertiesSchema = z.object({
203205
terrain: TerrainSchema.optional()
204206
.nullable()
205207
.describe('Global terrain elevation'),
206-
fog: z.record(z.any()).optional().nullable().describe('Fog properties'),
208+
fog: z
209+
.record(z.string(), z.any())
210+
.optional()
211+
.nullable()
212+
.describe('Fog properties'),
207213
projection: z
208-
.record(z.any())
214+
.record(z.string(), z.any())
209215
.optional()
210216
.nullable()
211217
.describe('Map projection'),

‎src/tools/compare-styles-tool/CompareStylesTool.input.schema.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { z } from 'zod';
55

66
export const CompareStylesInputSchema = z.object({
77
styleA: z
8-
.union([z.string(), z.record(z.unknown())])
8+
.union([z.string(), z.record(z.string(), z.unknown())])
99
.describe('First Mapbox style (JSON string or style object)'),
1010
styleB: z
11-
.union([z.string(), z.record(z.unknown())])
11+
.union([z.string(), z.record(z.string(), z.unknown())])
1212
.describe('Second Mapbox style (JSON string or style object)'),
1313
ignoreMetadata: z
1414
.boolean()

‎src/tools/create-style-tool/CreateStyleTool.input.schema.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { z } from 'zod';
99
export const CreateStyleInputSchema = z.object({
1010
name: z.string().describe('Human-readable name for the style'),
1111
style: z
12-
.record(z.any())
12+
.record(z.string(), z.any())
1313
.describe(
1414
'Complete Mapbox Style Specification object. Must include: version (8), sources, layers. Optional: sprite, glyphs, center, zoom, bearing, pitch, metadata, etc. See https://docs.mapbox.com/mapbox-gl-js/style-spec/'
1515
)

‎src/tools/list-styles-tool/ListStylesTool.output.schema.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ const StyleMetadataSchema = z.object({
3030
pitch: z.number().optional().describe('Default pitch in degrees'),
3131

3232
// Sources and layers may or may not be included in list responses
33-
sources: z.record(z.any()).optional().describe('Style data sources'),
33+
sources: z
34+
.record(z.string(), z.any())
35+
.optional()
36+
.describe('Style data sources'),
3437
layers: z.array(z.any()).optional().describe('Style layers'),
3538

3639
// Additional metadata fields

‎src/tools/optimize-style-tool/OptimizeStyleTool.input.schema.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { z } from 'zod';
55

66
export const OptimizeStyleInputSchema = z.object({
77
style: z
8-
.union([z.string(), z.record(z.unknown())])
8+
.union([z.string(), z.record(z.string(), z.unknown())])
99
.describe('Mapbox style to optimize (JSON string or style object)'),
1010
optimizations: z
1111
.array(

‎src/tools/optimize-style-tool/OptimizeStyleTool.output.schema.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const OptimizationSchema = z.object({
1010
});
1111

1212
export const OptimizeStyleOutputSchema = z.object({
13-
optimizedStyle: z.record(z.unknown()).describe('The optimized Mapbox style'),
13+
optimizedStyle: z
14+
.record(z.string(), z.unknown())
15+
.describe('The optimized Mapbox style'),
1416
optimizations: z
1517
.array(OptimizationSchema)
1618
.describe('List of optimizations that were applied'),

‎src/tools/style-builder-tool/StyleBuilderTool.input.schema.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const LayerConfigSchema = z.object({
5252
z.number(),
5353
z.boolean(),
5454
z.array(z.unknown()),
55-
z.record(z.unknown())
55+
z.record(z.string(), z.unknown())
5656
])
5757
.optional()
5858
.describe('Custom filter expression'),
@@ -109,7 +109,7 @@ const LayerConfigSchema = z.object({
109109
z.number(),
110110
z.boolean(),
111111
z.array(z.unknown()),
112-
z.record(z.unknown())
112+
z.record(z.string(), z.unknown())
113113
])
114114
.optional()
115115
.describe('Custom Mapbox expression for advanced styling'),

0 commit comments

Comments
 (0)