Skip to content

Commit 248b6ab

Browse files
anotherjesseclaude
andcommitted
fix: update schema transform test fixtures for complex defaults
Update expected output files to match the actual formatting produced by the schema transformer when handling complex default values: - Object defaults are formatted with properties on separate lines - Array oneOf formatting uses array literal syntax - Add missing default values for arrays in default-type test - Remove default: undefined (undefined values don't have defaults) All js-runtime tests now pass with the enhanced Default type support. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2b0c842 commit 248b6ab

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

packages/js-runtime/test/fixtures/schema-transform/complex-defaults.expected.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ export const objectDefaultsSchema = {
111111
}
112112
},
113113
required: ["theme", "count"],
114-
default: { theme: "dark", count: 10 }
114+
default: {
115+
theme: "dark",
116+
count: 10
117+
}
115118
},
116119
user: {
117120
type: "object",
@@ -148,15 +151,15 @@ export const nullDefaultsSchema = {
148151
type: "object",
149152
properties: {
150153
nullable: {
151-
oneOf: [
152-
{ type: "string" },
153-
{ type: "null" }
154-
],
154+
oneOf: [{
155+
type: "null"
156+
}, {
157+
type: "string"
158+
}],
155159
default: null
156160
},
157161
undefinable: {
158-
type: "string",
159-
default: undefined
162+
type: "string"
160163
}
161164
},
162165
required: ["nullable", "undefinable"]

packages/js-runtime/test/fixtures/schema-transform/default-type.expected.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ const listConfigSchema = {
9898
type: "array",
9999
items: {
100100
type: "string"
101-
}
101+
},
102+
default: ["item1", "item2"]
102103
},
103104
selectedIndices: {
104105
type: "array",
105106
items: {
106107
type: "number"
107-
}
108+
},
109+
default: [0]
108110
}
109111
},
110112
required: ["items", "selectedIndices"]
@@ -139,7 +141,11 @@ const complexDefaultSchema = {
139141
type: "string"
140142
}
141143
},
142-
required: ["version", "author"]
144+
required: ["version", "author"],
145+
default: {
146+
version: 1,
147+
author: "system"
148+
}
143149
},
144150
config: {
145151
type: "object",
@@ -151,7 +157,11 @@ const complexDefaultSchema = {
151157
type: "number"
152158
}
153159
},
154-
required: ["enabled", "value"]
160+
required: ["enabled", "value"],
161+
default: {
162+
enabled: true,
163+
value: 100
164+
}
155165
}
156166
},
157167
required: ["metadata", "config"]
@@ -175,6 +185,7 @@ const cellDefaultsSchema = {
175185
items: {
176186
type: "string"
177187
},
188+
default: [],
178189
asCell: true
179190
}
180191
},

0 commit comments

Comments
 (0)