fork of hey-api/openapi-ts because I need some additional things

Merge pull request #2945 from hey-api/copilot/fix-additional-properties-issue

Fix Valibot strictObject for additionalProperties: false

authored by

Lubos and committed by
GitHub
fe8a27bf 7c3f5b4a

+372 -258
+5
.changeset/nine-cups-carry.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + valibot: use `.strictObject()` instead of `.objectWithRest()` when additional properties are not allowed
+14 -14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts
··· 995 995 value: v.pipe(v.number(), v.integer()) 996 996 }, v.pipe(v.number(), v.integer())); 997 997 998 - export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({ 998 + export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ 999 999 item: v.optional(v.boolean()), 1000 1000 error: v.optional(v.union([ 1001 1001 v.string(), 1002 1002 v.null() 1003 1003 ])), 1004 1004 hasError: v.optional(v.pipe(v.boolean(), v.readonly())), 1005 - data: v.optional(v.record(v.string(), v.never())) 1006 - }, v.never()); 1005 + data: v.optional(v.strictObject({})) 1006 + }); 1007 1007 1008 - export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ 1008 + export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ 1009 1009 item: v.optional(v.union([ 1010 1010 v.string(), 1011 1011 v.null() ··· 1015 1015 v.null() 1016 1016 ])), 1017 1017 hasError: v.optional(v.pipe(v.boolean(), v.readonly())) 1018 - }, v.never()); 1018 + }); 1019 1019 1020 1020 export const vOneOfAllOfIssue = v.union([ 1021 1021 v.intersect([ ··· 1117 1117 vGenericSchemaDuplicateIssue1SystemString 1118 1118 ]); 1119 1119 1120 - export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({ 1120 + export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ 1121 1121 item: v.optional(v.boolean()), 1122 1122 error: v.optional(v.union([ 1123 1123 v.string(), 1124 1124 v.null() 1125 1125 ])), 1126 - data: v.optional(v.record(v.string(), v.never())) 1127 - }, v.never()); 1126 + data: v.optional(v.strictObject({})) 1127 + }); 1128 1128 1129 - export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({ 1129 + export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ 1130 1130 item: v.optional(v.union([ 1131 1131 v.string(), 1132 1132 v.null() ··· 1135 1135 v.string(), 1136 1136 v.null() 1137 1137 ])) 1138 - }, v.never()); 1138 + }); 1139 1139 1140 1140 /** 1141 1141 * This is a reusable parameter ··· 1144 1144 1145 1145 export const vCompositionWithOneOfAndProperties = v.intersect([ 1146 1146 v.union([ 1147 - v.objectWithRest({ 1147 + v.strictObject({ 1148 1148 foo: vSimpleParameter 1149 - }, v.never()), 1150 - v.objectWithRest({ 1149 + }), 1150 + v.strictObject({ 1151 1151 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 1152 - }, v.never()) 1152 + }) 1153 1153 ]), 1154 1154 v.object({ 1155 1155 baz: v.union([
+14 -14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts
··· 993 993 value: v.pipe(v.number(), v.integer()) 994 994 }, v.pipe(v.number(), v.integer())); 995 995 996 - export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({ 996 + export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ 997 997 item: v.optional(v.boolean()), 998 998 error: v.optional(v.union([ 999 999 v.string(), 1000 1000 v.null() 1001 1001 ])), 1002 1002 hasError: v.optional(v.pipe(v.boolean(), v.readonly())), 1003 - data: v.optional(v.record(v.string(), v.never())) 1004 - }, v.never()); 1003 + data: v.optional(v.strictObject({})) 1004 + }); 1005 1005 1006 - export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ 1006 + export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ 1007 1007 item: v.optional(v.union([ 1008 1008 v.string(), 1009 1009 v.null() ··· 1013 1013 v.null() 1014 1014 ])), 1015 1015 hasError: v.optional(v.pipe(v.boolean(), v.readonly())) 1016 - }, v.never()); 1016 + }); 1017 1017 1018 1018 export const vOneOfAllOfIssue = v.union([ 1019 1019 v.intersect([ ··· 1121 1121 vGenericSchemaDuplicateIssue1SystemString 1122 1122 ]); 1123 1123 1124 - export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({ 1124 + export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ 1125 1125 item: v.optional(v.boolean()), 1126 1126 error: v.optional(v.union([ 1127 1127 v.string(), 1128 1128 v.null() 1129 1129 ])), 1130 - data: v.optional(v.record(v.string(), v.never())) 1131 - }, v.never()); 1130 + data: v.optional(v.strictObject({})) 1131 + }); 1132 1132 1133 - export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({ 1133 + export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ 1134 1134 item: v.optional(v.union([ 1135 1135 v.string(), 1136 1136 v.null() ··· 1139 1139 v.string(), 1140 1140 v.null() 1141 1141 ])) 1142 - }, v.never()); 1142 + }); 1143 1143 1144 1144 /** 1145 1145 * This is a reusable parameter ··· 1148 1148 1149 1149 export const vCompositionWithOneOfAndProperties = v.intersect([ 1150 1150 v.union([ 1151 - v.objectWithRest({ 1151 + v.strictObject({ 1152 1152 foo: vSimpleParameter 1153 - }, v.never()), 1154 - v.objectWithRest({ 1153 + }), 1154 + v.strictObject({ 1155 1155 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 1156 - }, v.never()) 1156 + }) 1157 1157 ]), 1158 1158 v.object({ 1159 1159 baz: v.union([
+4 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vBar: v.GenericSchema = v.objectWithRest({ 5 + export const vBar: v.GenericSchema = v.strictObject({ 6 6 bar: v.union([ 7 7 v.array(v.lazy(() => { 8 8 return vBar; 9 9 })), 10 10 v.null() 11 11 ]) 12 - }, v.never()); 12 + }); 13 13 14 - export const vFoo = v.objectWithRest({ 14 + export const vFoo = v.strictObject({ 15 15 foo: vBar 16 - }, v.never()); 16 + });
+226 -226
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts
··· 3 3 import * as v from 'valibot'; 4 4 5 5 export const vSessionUserPhoneCalloutRingingWebhookRequest = v.object({ 6 - body: v.optional(v.objectWithRest({ 6 + body: v.optional(v.strictObject({ 7 7 event: v.string(), 8 8 event_ts: v.pipe(v.union([ 9 9 v.number(), 10 10 v.string(), 11 11 v.bigint() 12 12 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 13 - payload: v.objectWithRest({ 13 + payload: v.strictObject({ 14 14 account_id: v.string(), 15 - object: v.objectWithRest({ 15 + object: v.strictObject({ 16 16 id: v.optional(v.pipe(v.union([ 17 17 v.number(), 18 18 v.string(), ··· 24 24 session_key: v.string(), 25 25 user_key: v.string(), 26 26 host_id: v.string(), 27 - participant: v.objectWithRest({ 27 + participant: v.strictObject({ 28 28 invitee_name: v.string(), 29 29 phone_number: v.pipe(v.union([ 30 30 v.number(), ··· 36 36 v.string(), 37 37 v.bigint() 38 38 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 39 - }, v.never()) 40 - }, v.never()) 41 - }, v.never()) 42 - }, v.never())), 39 + }) 40 + }) 41 + }) 42 + })), 43 43 path: v.optional(v.never()), 44 44 query: v.optional(v.never()) 45 45 }); 46 46 47 47 export const vSessionUserRoomSystemCalloutRingingWebhookRequest = v.object({ 48 - body: v.optional(v.objectWithRest({ 48 + body: v.optional(v.strictObject({ 49 49 event: v.string(), 50 50 event_ts: v.pipe(v.union([ 51 51 v.number(), 52 52 v.string(), 53 53 v.bigint() 54 54 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 55 - payload: v.objectWithRest({ 55 + payload: v.strictObject({ 56 56 account_id: v.string(), 57 - object: v.objectWithRest({ 57 + object: v.strictObject({ 58 58 id: v.optional(v.pipe(v.union([ 59 59 v.number(), 60 60 v.string(), ··· 70 70 call_type: v.string(), 71 71 device_ip: v.string() 72 72 }, v.unknown()) 73 - }, v.never()) 74 - }, v.never()) 75 - }, v.never())), 73 + }) 74 + }) 75 + })), 76 76 path: v.optional(v.never()), 77 77 query: v.optional(v.never()) 78 78 }); 79 79 80 80 export const vSessionRecordingStartedWebhookRequest = v.object({ 81 - body: v.optional(v.objectWithRest({ 81 + body: v.optional(v.strictObject({ 82 82 event: v.picklist([ 83 83 'session.recording_started' 84 84 ]), ··· 87 87 v.string(), 88 88 v.bigint() 89 89 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 90 - payload: v.objectWithRest({ 90 + payload: v.strictObject({ 91 91 account_id: v.string(), 92 - object: v.objectWithRest({ 92 + object: v.strictObject({ 93 93 session_id: v.string(), 94 94 session_name: v.string(), 95 95 session_key: v.string(), ··· 99 99 recording_start: v.optional(v.string()), 100 100 recording_end: v.optional(v.string()) 101 101 }) 102 - }, v.never()) 103 - }, v.never()) 104 - }, v.never())), 102 + }) 103 + }) 104 + })), 105 105 path: v.optional(v.never()), 106 106 query: v.optional(v.never()) 107 107 }); 108 108 109 109 export const vSessionRecordingResumedWebhookRequest = v.object({ 110 - body: v.optional(v.objectWithRest({ 110 + body: v.optional(v.strictObject({ 111 111 event: v.picklist([ 112 112 'session.recording_resumed' 113 113 ]), ··· 116 116 v.string(), 117 117 v.bigint() 118 118 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 119 - payload: v.objectWithRest({ 119 + payload: v.strictObject({ 120 120 account_id: v.string(), 121 - object: v.objectWithRest({ 121 + object: v.strictObject({ 122 122 session_id: v.string(), 123 123 session_name: v.string(), 124 124 session_key: v.string(), ··· 128 128 recording_start: v.optional(v.string()), 129 129 recording_end: v.optional(v.string()) 130 130 }) 131 - }, v.never()) 132 - }, v.never()) 133 - }, v.never())), 131 + }) 132 + }) 133 + })), 134 134 path: v.optional(v.never()), 135 135 query: v.optional(v.never()) 136 136 }); 137 137 138 138 export const vSessionLiveStreamingStoppedWebhookRequest = v.object({ 139 - body: v.optional(v.objectWithRest({ 139 + body: v.optional(v.strictObject({ 140 140 event: v.picklist([ 141 141 'session.live_streaming_stopped' 142 142 ]), ··· 145 145 v.string(), 146 146 v.bigint() 147 147 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 148 - payload: v.objectWithRest({ 148 + payload: v.strictObject({ 149 149 account_id: v.string(), 150 - object: v.objectWithRest({ 150 + object: v.strictObject({ 151 151 id: v.string(), 152 152 session_id: v.string(), 153 153 session_name: v.string(), ··· 168 168 }), 169 169 date_time: v.pipe(v.string(), v.isoTimestamp()) 170 170 }) 171 - }, v.never()) 172 - }, v.never()) 173 - }, v.never())), 171 + }) 172 + }) 173 + })), 174 174 path: v.optional(v.never()), 175 175 query: v.optional(v.never()) 176 176 }); 177 177 178 178 export const vSessionStreamIngestionStoppedWebhookRequest = v.object({ 179 - body: v.optional(v.objectWithRest({ 179 + body: v.optional(v.strictObject({ 180 180 event: v.picklist([ 181 181 'session.stream_ingestion_stopped' 182 182 ]), ··· 185 185 v.string(), 186 186 v.bigint() 187 187 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 188 - payload: v.objectWithRest({ 188 + payload: v.strictObject({ 189 189 account_id: v.string(), 190 - object: v.objectWithRest({ 190 + object: v.strictObject({ 191 191 session_id: v.string(), 192 192 session_name: v.string(), 193 193 session_key: v.optional(v.string()), ··· 199 199 stream_url: v.string(), 200 200 backup_stream_url: v.string() 201 201 }) 202 - }, v.never()) 203 - }, v.never()) 204 - }, v.never())), 202 + }) 203 + }) 204 + })), 205 205 path: v.optional(v.never()), 206 206 query: v.optional(v.never()) 207 207 }); 208 208 209 209 export const vSessionUserRoomSystemCalloutRejectedWebhookRequest = v.object({ 210 - body: v.optional(v.objectWithRest({ 210 + body: v.optional(v.strictObject({ 211 211 event: v.string(), 212 212 event_ts: v.pipe(v.union([ 213 213 v.number(), 214 214 v.string(), 215 215 v.bigint() 216 216 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 217 - payload: v.objectWithRest({ 217 + payload: v.strictObject({ 218 218 account_id: v.string(), 219 - object: v.objectWithRest({ 219 + object: v.strictObject({ 220 220 id: v.optional(v.pipe(v.union([ 221 221 v.number(), 222 222 v.string(), ··· 232 232 call_type: v.string(), 233 233 device_ip: v.string() 234 234 }, v.unknown()) 235 - }, v.never()) 236 - }, v.never()) 237 - }, v.never())), 235 + }) 236 + }) 237 + })), 238 238 path: v.optional(v.never()), 239 239 query: v.optional(v.never()) 240 240 }); 241 241 242 242 export const vSessionAlertWebhookRequest = v.object({ 243 - body: v.optional(v.objectWithRest({ 243 + body: v.optional(v.strictObject({ 244 244 event: v.picklist([ 245 245 'session.alert' 246 246 ]), ··· 249 249 v.string(), 250 250 v.bigint() 251 251 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 252 - payload: v.objectWithRest({ 252 + payload: v.strictObject({ 253 253 account_id: v.string(), 254 - object: v.objectWithRest({ 254 + object: v.strictObject({ 255 255 id: v.string(), 256 256 session_id: v.string(), 257 257 session_name: v.string(), ··· 263 263 'High CPU occupation', 264 264 'Call Reconnection' 265 265 ])) 266 - }, v.never()) 267 - }, v.never()) 268 - }, v.never())), 266 + }) 267 + }) 268 + })), 269 269 path: v.optional(v.never()), 270 270 query: v.optional(v.never()) 271 271 }); 272 272 273 273 export const vSessionSharingEndedWebhookRequest = v.object({ 274 - body: v.optional(v.objectWithRest({ 274 + body: v.optional(v.strictObject({ 275 275 event: v.picklist([ 276 276 'session.sharing_ended' 277 277 ]), ··· 280 280 v.string(), 281 281 v.bigint() 282 282 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 283 - payload: v.objectWithRest({ 283 + payload: v.strictObject({ 284 284 account_id: v.string(), 285 - object: v.objectWithRest({ 285 + object: v.strictObject({ 286 286 id: v.string(), 287 287 session_id: v.string(), 288 288 session_name: v.string(), 289 289 session_key: v.optional(v.string()), 290 - user: v.objectWithRest({ 290 + user: v.strictObject({ 291 291 id: v.string(), 292 292 name: v.string(), 293 293 user_key: v.optional(v.string()), 294 - sharing_details: v.objectWithRest({ 294 + sharing_details: v.strictObject({ 295 295 content: v.picklist([ 296 296 'application', 297 297 'whiteboard', ··· 299 299 'unknown' 300 300 ]), 301 301 date_time: v.pipe(v.string(), v.isoTimestamp()) 302 - }, v.never()) 303 - }, v.never()) 304 - }, v.never()) 305 - }, v.never()) 306 - }, v.never())), 302 + }) 303 + }) 304 + }) 305 + }) 306 + })), 307 307 path: v.optional(v.never()), 308 308 query: v.optional(v.never()) 309 309 }); 310 310 311 311 export const vSessionRecordingPausedWebhookRequest = v.object({ 312 - body: v.optional(v.objectWithRest({ 312 + body: v.optional(v.strictObject({ 313 313 event: v.picklist([ 314 314 'session.recording_paused' 315 315 ]), ··· 318 318 v.string(), 319 319 v.bigint() 320 320 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 321 - payload: v.objectWithRest({ 321 + payload: v.strictObject({ 322 322 account_id: v.string(), 323 - object: v.objectWithRest({ 323 + object: v.strictObject({ 324 324 session_id: v.string(), 325 325 session_name: v.string(), 326 326 session_key: v.string(), ··· 330 330 recording_start: v.optional(v.string()), 331 331 recording_end: v.optional(v.string()) 332 332 }) 333 - }, v.never()) 334 - }, v.never()) 335 - }, v.never())), 333 + }) 334 + }) 335 + })), 336 336 path: v.optional(v.never()), 337 337 query: v.optional(v.never()) 338 338 }); 339 339 340 340 export const vSessionEndedWebhookRequest = v.object({ 341 - body: v.optional(v.objectWithRest({ 341 + body: v.optional(v.strictObject({ 342 342 event: v.picklist([ 343 343 'session.ended' 344 344 ]), ··· 347 347 v.string(), 348 348 v.bigint() 349 349 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 350 - payload: v.objectWithRest({ 350 + payload: v.strictObject({ 351 351 account_id: v.string(), 352 - object: v.objectWithRest({ 352 + object: v.strictObject({ 353 353 id: v.string(), 354 354 session_id: v.string(), 355 355 session_name: v.string(), 356 356 session_key: v.optional(v.string()), 357 357 start_time: v.pipe(v.string(), v.isoTimestamp()), 358 358 end_time: v.pipe(v.string(), v.isoTimestamp()) 359 - }, v.never()) 360 - }, v.never()) 361 - }, v.never())), 359 + }) 360 + }) 361 + })), 362 362 path: v.optional(v.never()), 363 363 query: v.optional(v.never()) 364 364 }); 365 365 366 366 export const vSessionStartedWebhookRequest = v.object({ 367 - body: v.optional(v.objectWithRest({ 367 + body: v.optional(v.strictObject({ 368 368 event: v.picklist([ 369 369 'session.started' 370 370 ]), ··· 373 373 v.string(), 374 374 v.bigint() 375 375 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 376 - payload: v.objectWithRest({ 376 + payload: v.strictObject({ 377 377 account_id: v.string(), 378 - object: v.objectWithRest({ 378 + object: v.strictObject({ 379 379 id: v.string(), 380 380 session_id: v.string(), 381 381 session_name: v.string(), 382 382 session_key: v.optional(v.string()), 383 383 start_time: v.pipe(v.string(), v.isoTimestamp()) 384 - }, v.never()) 385 - }, v.never()) 386 - }, v.never())), 384 + }) 385 + }) 386 + })), 387 387 path: v.optional(v.never()), 388 388 query: v.optional(v.never()) 389 389 }); 390 390 391 391 export const vSessionStreamIngestionUnbindWebhookRequest = v.object({ 392 - body: v.optional(v.objectWithRest({ 392 + body: v.optional(v.strictObject({ 393 393 event: v.picklist([ 394 394 'session.stream_ingestion_unbind' 395 395 ]), ··· 398 398 v.string(), 399 399 v.bigint() 400 400 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 401 - payload: v.objectWithRest({ 401 + payload: v.strictObject({ 402 402 account_id: v.string(), 403 - object: v.objectWithRest({ 403 + object: v.strictObject({ 404 404 session_id: v.string(), 405 405 session_name: v.string(), 406 406 session_key: v.optional(v.string()), ··· 412 412 stream_url: v.string(), 413 413 backup_stream_url: v.string() 414 414 }) 415 - }, v.never()) 416 - }, v.never()) 417 - }, v.never())), 415 + }) 416 + }) 417 + })), 418 418 path: v.optional(v.never()), 419 419 query: v.optional(v.never()) 420 420 }); 421 421 422 422 export const vSessionLiveStreamingStartedWebhookRequest = v.object({ 423 - body: v.optional(v.objectWithRest({ 423 + body: v.optional(v.strictObject({ 424 424 event: v.picklist([ 425 425 'session.live_streaming_started' 426 426 ]), ··· 429 429 v.string(), 430 430 v.bigint() 431 431 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 432 - payload: v.objectWithRest({ 432 + payload: v.strictObject({ 433 433 account_id: v.string(), 434 - object: v.objectWithRest({ 434 + object: v.strictObject({ 435 435 id: v.string(), 436 436 session_id: v.string(), 437 437 session_name: v.string(), ··· 452 452 }), 453 453 date_time: v.pipe(v.string(), v.isoTimestamp()) 454 454 }) 455 - }, v.never()) 456 - }, v.never()) 457 - }, v.never())), 455 + }) 456 + }) 457 + })), 458 458 path: v.optional(v.never()), 459 459 query: v.optional(v.never()) 460 460 }); 461 461 462 462 export const vSessionUserRoomSystemCalloutMissedWebhookRequest = v.object({ 463 - body: v.optional(v.objectWithRest({ 463 + body: v.optional(v.strictObject({ 464 464 event: v.string(), 465 465 event_ts: v.pipe(v.union([ 466 466 v.number(), 467 467 v.string(), 468 468 v.bigint() 469 469 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 470 - payload: v.objectWithRest({ 470 + payload: v.strictObject({ 471 471 account_id: v.string(), 472 - object: v.objectWithRest({ 472 + object: v.strictObject({ 473 473 id: v.optional(v.pipe(v.union([ 474 474 v.number(), 475 475 v.string(), ··· 485 485 call_type: v.string(), 486 486 device_ip: v.string() 487 487 }, v.unknown()) 488 - }, v.never()) 489 - }, v.never()) 490 - }, v.never())), 488 + }) 489 + }) 490 + })), 491 491 path: v.optional(v.never()), 492 492 query: v.optional(v.never()) 493 493 }); 494 494 495 495 export const vSessionUserPhoneCalloutAcceptedWebhookRequest = v.object({ 496 - body: v.optional(v.objectWithRest({ 496 + body: v.optional(v.strictObject({ 497 497 event: v.string(), 498 498 event_ts: v.pipe(v.union([ 499 499 v.number(), 500 500 v.string(), 501 501 v.bigint() 502 502 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 503 - payload: v.objectWithRest({ 503 + payload: v.strictObject({ 504 504 account_id: v.string(), 505 - object: v.objectWithRest({ 505 + object: v.strictObject({ 506 506 id: v.optional(v.pipe(v.union([ 507 507 v.number(), 508 508 v.string(), ··· 514 514 session_key: v.string(), 515 515 user_key: v.string(), 516 516 host_id: v.string(), 517 - participant: v.objectWithRest({ 517 + participant: v.strictObject({ 518 518 invitee_name: v.string(), 519 519 phone_number: v.pipe(v.union([ 520 520 v.number(), ··· 526 526 v.string(), 527 527 v.bigint() 528 528 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 529 - }, v.never()) 530 - }, v.never()) 531 - }, v.never()) 532 - }, v.never())), 529 + }) 530 + }) 531 + }) 532 + })), 533 533 path: v.optional(v.never()), 534 534 query: v.optional(v.never()) 535 535 }); 536 536 537 537 export const vSessionUserLeftWebhookRequest = v.object({ 538 - body: v.optional(v.objectWithRest({ 538 + body: v.optional(v.strictObject({ 539 539 event: v.picklist([ 540 540 'session.user_left' 541 541 ]), ··· 544 544 v.string(), 545 545 v.bigint() 546 546 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 547 - payload: v.objectWithRest({ 547 + payload: v.strictObject({ 548 548 account_id: v.string(), 549 - object: v.objectWithRest({ 549 + object: v.strictObject({ 550 550 id: v.string(), 551 551 session_id: v.string(), 552 552 session_name: v.string(), 553 553 session_key: v.optional(v.string()), 554 - user: v.objectWithRest({ 554 + user: v.strictObject({ 555 555 id: v.string(), 556 556 name: v.string(), 557 557 leave_time: v.pipe(v.string(), v.isoTimestamp()), ··· 559 559 user_key: v.optional(v.string()), 560 560 phone_number: v.optional(v.string()), 561 561 participant_uuid: v.string() 562 - }, v.never()) 563 - }, v.never()) 564 - }, v.never()) 565 - }, v.never())), 562 + }) 563 + }) 564 + }) 565 + })), 566 566 path: v.optional(v.never()), 567 567 query: v.optional(v.never()) 568 568 }); 569 569 570 570 export const vSessionSharingStartedWebhookRequest = v.object({ 571 - body: v.optional(v.objectWithRest({ 571 + body: v.optional(v.strictObject({ 572 572 event: v.picklist([ 573 573 'session.sharing_started' 574 574 ]), ··· 577 577 v.string(), 578 578 v.bigint() 579 579 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 580 - payload: v.objectWithRest({ 580 + payload: v.strictObject({ 581 581 account_id: v.string(), 582 - object: v.objectWithRest({ 582 + object: v.strictObject({ 583 583 id: v.string(), 584 584 session_id: v.string(), 585 585 session_name: v.string(), 586 586 session_key: v.optional(v.string()), 587 - user: v.objectWithRest({ 587 + user: v.strictObject({ 588 588 id: v.string(), 589 589 name: v.string(), 590 590 user_key: v.optional(v.string()), 591 - sharing_details: v.objectWithRest({ 591 + sharing_details: v.strictObject({ 592 592 content: v.picklist([ 593 593 'application', 594 594 'whiteboard', ··· 596 596 'unknown' 597 597 ]), 598 598 date_time: v.pipe(v.string(), v.isoTimestamp()) 599 - }, v.never()) 600 - }, v.never()) 601 - }, v.never()) 602 - }, v.never()) 603 - }, v.never())), 599 + }) 600 + }) 601 + }) 602 + }) 603 + })), 604 604 path: v.optional(v.never()), 605 605 query: v.optional(v.never()) 606 606 }); 607 607 608 608 export const vSessionUserPhoneCalloutCanceledWebhookRequest = v.object({ 609 - body: v.optional(v.objectWithRest({ 609 + body: v.optional(v.strictObject({ 610 610 event: v.string(), 611 611 event_ts: v.pipe(v.union([ 612 612 v.number(), 613 613 v.string(), 614 614 v.bigint() 615 615 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 616 - payload: v.objectWithRest({ 616 + payload: v.strictObject({ 617 617 account_id: v.string(), 618 - object: v.objectWithRest({ 618 + object: v.strictObject({ 619 619 session_id: v.string(), 620 620 session_name: v.string(), 621 621 session_key: v.string(), 622 622 user_key: v.string(), 623 - participant: v.objectWithRest({ 623 + participant: v.strictObject({ 624 624 invitee_name: v.string(), 625 625 phone_number: v.pipe(v.union([ 626 626 v.number(), ··· 632 632 v.string(), 633 633 v.bigint() 634 634 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 635 - }, v.never()) 636 - }, v.never()) 637 - }, v.never()) 638 - }, v.never())), 635 + }) 636 + }) 637 + }) 638 + })), 639 639 path: v.optional(v.never()), 640 640 query: v.optional(v.never()) 641 641 }); 642 642 643 643 export const vSessionRecordingTranscriptCompletedWebhookRequest = v.object({ 644 - body: v.optional(v.objectWithRest({ 644 + body: v.optional(v.strictObject({ 645 645 event: v.picklist([ 646 646 'session.recording_transcript_completed' 647 647 ]), ··· 651 651 v.bigint() 652 652 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 653 653 download_token: v.string(), 654 - payload: v.objectWithRest({ 654 + payload: v.strictObject({ 655 655 account_id: v.string(), 656 - object: v.objectWithRest({ 656 + object: v.strictObject({ 657 657 session_id: v.string(), 658 658 session_name: v.string(), 659 659 session_key: v.string(), ··· 710 710 'chat_message' 711 711 ])) 712 712 })) 713 - }, v.never()) 714 - }, v.never()) 715 - }, v.never())), 713 + }) 714 + }) 715 + })), 716 716 path: v.optional(v.never()), 717 717 query: v.optional(v.never()) 718 718 }); 719 719 720 720 export const vSessionRecordingDeletedWebhookRequest = v.object({ 721 - body: v.optional(v.objectWithRest({ 721 + body: v.optional(v.strictObject({ 722 722 event: v.picklist([ 723 723 'session.recording_deleted' 724 724 ]), ··· 727 727 v.string(), 728 728 v.bigint() 729 729 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 730 - payload: v.objectWithRest({ 730 + payload: v.strictObject({ 731 731 account_id: v.string(), 732 732 operator: v.pipe(v.string(), v.email()), 733 733 operator_id: v.string(), 734 - object: v.objectWithRest({ 734 + object: v.strictObject({ 735 735 session_id: v.string(), 736 736 session_name: v.string(), 737 737 session_key: v.string(), 738 738 start_time: v.pipe(v.string(), v.isoTimestamp()), 739 739 timezone: v.string() 740 - }, v.never()) 741 - }, v.never()) 742 - }, v.never())), 740 + }) 741 + }) 742 + })), 743 743 path: v.optional(v.never()), 744 744 query: v.optional(v.never()) 745 745 }); 746 746 747 747 export const vSessionUserRoomSystemCalloutFailedWebhookRequest = v.object({ 748 - body: v.optional(v.objectWithRest({ 748 + body: v.optional(v.strictObject({ 749 749 event: v.string(), 750 750 event_ts: v.pipe(v.union([ 751 751 v.number(), 752 752 v.string(), 753 753 v.bigint() 754 754 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 755 - payload: v.objectWithRest({ 755 + payload: v.strictObject({ 756 756 account_id: v.string(), 757 - object: v.objectWithRest({ 757 + object: v.strictObject({ 758 758 id: v.optional(v.pipe(v.union([ 759 759 v.number(), 760 760 v.string(), ··· 771 771 call_type: v.string(), 772 772 device_ip: v.string() 773 773 }, v.unknown()) 774 - }, v.never()) 775 - }, v.never()) 776 - }, v.never())), 774 + }) 775 + }) 776 + })), 777 777 path: v.optional(v.never()), 778 778 query: v.optional(v.never()) 779 779 }); 780 780 781 781 export const vSessionRecordingCompletedWebhookRequest = v.object({ 782 - body: v.optional(v.objectWithRest({ 782 + body: v.optional(v.strictObject({ 783 783 event: v.picklist([ 784 784 'session.recording_completed' 785 785 ]), ··· 789 789 v.bigint() 790 790 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 791 791 download_token: v.string(), 792 - payload: v.objectWithRest({ 792 + payload: v.strictObject({ 793 793 account_id: v.string(), 794 - object: v.objectWithRest({ 794 + object: v.strictObject({ 795 795 session_id: v.string(), 796 796 session_name: v.string(), 797 797 session_key: v.string(), ··· 923 923 user_id: v.optional(v.string()), 924 924 user_key: v.optional(v.string()) 925 925 }))) 926 - }, v.never()) 927 - }, v.never()) 928 - }, v.never())), 926 + }) 927 + }) 928 + })), 929 929 path: v.optional(v.never()), 930 930 query: v.optional(v.never()) 931 931 }); 932 932 933 933 export const vSessionRecordingTranscriptFailedWebhookRequest = v.object({ 934 - body: v.optional(v.objectWithRest({ 934 + body: v.optional(v.strictObject({ 935 935 event: v.picklist([ 936 936 'session.recording_transcript_failed' 937 937 ]), ··· 940 940 v.string(), 941 941 v.bigint() 942 942 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 943 - payload: v.objectWithRest({ 943 + payload: v.strictObject({ 944 944 account_id: v.string(), 945 - object: v.objectWithRest({ 945 + object: v.strictObject({ 946 946 session_id: v.string(), 947 947 session_name: v.string(), 948 948 session_key: v.string(), 949 949 start_time: v.pipe(v.string(), v.isoTimestamp()), 950 950 timezone: v.string() 951 - }, v.never()) 952 - }, v.never()) 953 - }, v.never())), 951 + }) 952 + }) 953 + })), 954 954 path: v.optional(v.never()), 955 955 query: v.optional(v.never()) 956 956 }); 957 957 958 958 export const vSessionRecordingTrashedWebhookRequest = v.object({ 959 - body: v.optional(v.objectWithRest({ 959 + body: v.optional(v.strictObject({ 960 960 event: v.picklist([ 961 961 'session.recording_trashed' 962 962 ]), ··· 965 965 v.string(), 966 966 v.bigint() 967 967 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 968 - payload: v.objectWithRest({ 968 + payload: v.strictObject({ 969 969 account_id: v.string(), 970 970 operator: v.pipe(v.string(), v.email()), 971 971 operator_id: v.string(), 972 - object: v.objectWithRest({ 972 + object: v.strictObject({ 973 973 session_id: v.string(), 974 974 session_name: v.string(), 975 975 session_key: v.string(), 976 976 start_time: v.pipe(v.string(), v.isoTimestamp()), 977 977 timezone: v.string() 978 - }, v.never()) 979 - }, v.never()) 980 - }, v.never())), 978 + }) 979 + }) 980 + })), 981 981 path: v.optional(v.never()), 982 982 query: v.optional(v.never()) 983 983 }); 984 984 985 985 export const vSessionUserJoinedWebhookRequest = v.object({ 986 - body: v.optional(v.objectWithRest({ 986 + body: v.optional(v.strictObject({ 987 987 event: v.picklist([ 988 988 'session.user_joined' 989 989 ]), ··· 992 992 v.string(), 993 993 v.bigint() 994 994 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 995 - payload: v.objectWithRest({ 995 + payload: v.strictObject({ 996 996 account_id: v.string(), 997 - object: v.objectWithRest({ 997 + object: v.strictObject({ 998 998 id: v.string(), 999 999 session_id: v.string(), 1000 1000 session_name: v.string(), 1001 1001 session_key: v.optional(v.string()), 1002 - user: v.objectWithRest({ 1002 + user: v.strictObject({ 1003 1003 id: v.string(), 1004 1004 name: v.string(), 1005 1005 join_time: v.pipe(v.string(), v.isoTimestamp()), 1006 1006 user_key: v.optional(v.string()), 1007 1007 phone_number: v.optional(v.string()), 1008 1008 participant_uuid: v.string() 1009 - }, v.never()) 1010 - }, v.never()) 1011 - }, v.never()) 1012 - }, v.never())), 1009 + }) 1010 + }) 1011 + }) 1012 + })), 1013 1013 path: v.optional(v.never()), 1014 1014 query: v.optional(v.never()) 1015 1015 }); 1016 1016 1017 1017 export const vSessionStreamIngestionStartedWebhookRequest = v.object({ 1018 - body: v.optional(v.objectWithRest({ 1018 + body: v.optional(v.strictObject({ 1019 1019 event: v.picklist([ 1020 1020 'session.stream_ingestion_started' 1021 1021 ]), ··· 1024 1024 v.string(), 1025 1025 v.bigint() 1026 1026 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1027 - payload: v.objectWithRest({ 1027 + payload: v.strictObject({ 1028 1028 account_id: v.string(), 1029 - object: v.objectWithRest({ 1029 + object: v.strictObject({ 1030 1030 session_id: v.string(), 1031 1031 session_name: v.string(), 1032 1032 session_key: v.optional(v.string()), ··· 1038 1038 stream_url: v.string(), 1039 1039 backup_stream_url: v.string() 1040 1040 }) 1041 - }, v.never()) 1042 - }, v.never()) 1043 - }, v.never())), 1041 + }) 1042 + }) 1043 + })), 1044 1044 path: v.optional(v.never()), 1045 1045 query: v.optional(v.never()) 1046 1046 }); 1047 1047 1048 1048 export const vSessionStreamIngestionConnectedWebhookRequest = v.object({ 1049 - body: v.optional(v.objectWithRest({ 1049 + body: v.optional(v.strictObject({ 1050 1050 event: v.picklist([ 1051 1051 'session.stream_ingestion_connected' 1052 1052 ]), ··· 1055 1055 v.string(), 1056 1056 v.bigint() 1057 1057 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1058 - payload: v.objectWithRest({ 1058 + payload: v.strictObject({ 1059 1059 account_id: v.string(), 1060 - object: v.objectWithRest({ 1060 + object: v.strictObject({ 1061 1061 session_id: v.string(), 1062 1062 session_name: v.string(), 1063 1063 session_key: v.optional(v.string()), ··· 1069 1069 stream_url: v.string(), 1070 1070 backup_stream_url: v.string() 1071 1071 }) 1072 - }, v.never()) 1073 - }, v.never()) 1074 - }, v.never())), 1072 + }) 1073 + }) 1074 + })), 1075 1075 path: v.optional(v.never()), 1076 1076 query: v.optional(v.never()) 1077 1077 }); 1078 1078 1079 1079 export const vSessionStreamIngestionDisconnectedWebhookRequest = v.object({ 1080 - body: v.optional(v.objectWithRest({ 1080 + body: v.optional(v.strictObject({ 1081 1081 event: v.picklist([ 1082 1082 'session.stream_ingestion_disconnected' 1083 1083 ]), ··· 1086 1086 v.string(), 1087 1087 v.bigint() 1088 1088 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1089 - payload: v.objectWithRest({ 1089 + payload: v.strictObject({ 1090 1090 account_id: v.string(), 1091 - object: v.objectWithRest({ 1091 + object: v.strictObject({ 1092 1092 session_id: v.string(), 1093 1093 session_name: v.string(), 1094 1094 session_key: v.optional(v.string()), ··· 1100 1100 stream_url: v.string(), 1101 1101 backup_stream_url: v.string() 1102 1102 }) 1103 - }, v.never()) 1104 - }, v.never()) 1105 - }, v.never())), 1103 + }) 1104 + }) 1105 + })), 1106 1106 path: v.optional(v.never()), 1107 1107 query: v.optional(v.never()) 1108 1108 }); 1109 1109 1110 1110 export const vSessionRecordingRecoveredWebhookRequest = v.object({ 1111 - body: v.optional(v.objectWithRest({ 1111 + body: v.optional(v.strictObject({ 1112 1112 event: v.picklist([ 1113 1113 'session.recording_recovered' 1114 1114 ]), ··· 1117 1117 v.string(), 1118 1118 v.bigint() 1119 1119 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1120 - payload: v.objectWithRest({ 1120 + payload: v.strictObject({ 1121 1121 account_id: v.string(), 1122 1122 operator: v.pipe(v.string(), v.email()), 1123 1123 operator_id: v.string(), 1124 - object: v.objectWithRest({ 1124 + object: v.strictObject({ 1125 1125 session_id: v.string(), 1126 1126 session_name: v.string(), 1127 1127 session_key: v.string(), 1128 1128 start_time: v.pipe(v.string(), v.isoTimestamp()), 1129 1129 timezone: v.string() 1130 - }, v.never()) 1131 - }, v.never()) 1132 - }, v.never())), 1130 + }) 1131 + }) 1132 + })), 1133 1133 path: v.optional(v.never()), 1134 1134 query: v.optional(v.never()) 1135 1135 }); 1136 1136 1137 1137 export const vSessionUserPhoneCalloutMissedWebhookRequest = v.object({ 1138 - body: v.optional(v.objectWithRest({ 1138 + body: v.optional(v.strictObject({ 1139 1139 event: v.string(), 1140 1140 event_ts: v.pipe(v.union([ 1141 1141 v.number(), 1142 1142 v.string(), 1143 1143 v.bigint() 1144 1144 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1145 - payload: v.objectWithRest({ 1145 + payload: v.strictObject({ 1146 1146 account_id: v.string(), 1147 - object: v.objectWithRest({ 1147 + object: v.strictObject({ 1148 1148 id: v.optional(v.pipe(v.union([ 1149 1149 v.number(), 1150 1150 v.string(), ··· 1156 1156 session_key: v.string(), 1157 1157 user_key: v.string(), 1158 1158 host_id: v.string(), 1159 - participant: v.objectWithRest({ 1159 + participant: v.strictObject({ 1160 1160 invitee_name: v.string(), 1161 1161 phone_number: v.pipe(v.union([ 1162 1162 v.number(), ··· 1168 1168 v.string(), 1169 1169 v.bigint() 1170 1170 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 1171 - }, v.never()) 1172 - }, v.never()) 1173 - }, v.never()) 1174 - }, v.never())), 1171 + }) 1172 + }) 1173 + }) 1174 + })), 1175 1175 path: v.optional(v.never()), 1176 1176 query: v.optional(v.never()) 1177 1177 }); 1178 1178 1179 1179 export const vSessionUserPhoneCalloutRejectedWebhookRequest = v.object({ 1180 - body: v.optional(v.objectWithRest({ 1180 + body: v.optional(v.strictObject({ 1181 1181 event: v.string(), 1182 1182 event_ts: v.pipe(v.union([ 1183 1183 v.number(), 1184 1184 v.string(), 1185 1185 v.bigint() 1186 1186 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1187 - payload: v.objectWithRest({ 1187 + payload: v.strictObject({ 1188 1188 account_id: v.string(), 1189 - object: v.objectWithRest({ 1189 + object: v.strictObject({ 1190 1190 id: v.optional(v.pipe(v.union([ 1191 1191 v.number(), 1192 1192 v.string(), ··· 1198 1198 session_key: v.string(), 1199 1199 user_key: v.string(), 1200 1200 host_id: v.string(), 1201 - participant: v.objectWithRest({ 1201 + participant: v.strictObject({ 1202 1202 invitee_name: v.string(), 1203 1203 phone_number: v.pipe(v.union([ 1204 1204 v.number(), ··· 1210 1210 v.string(), 1211 1211 v.bigint() 1212 1212 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 1213 - }, v.never()) 1214 - }, v.never()) 1215 - }, v.never()) 1216 - }, v.never())), 1213 + }) 1214 + }) 1215 + }) 1216 + })), 1217 1217 path: v.optional(v.never()), 1218 1218 query: v.optional(v.never()) 1219 1219 }); 1220 1220 1221 1221 export const vSessionUserRoomSystemCalloutAcceptedWebhookRequest = v.object({ 1222 - body: v.optional(v.objectWithRest({ 1222 + body: v.optional(v.strictObject({ 1223 1223 event: v.string(), 1224 1224 event_ts: v.pipe(v.union([ 1225 1225 v.number(), 1226 1226 v.string(), 1227 1227 v.bigint() 1228 1228 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1229 - payload: v.objectWithRest({ 1229 + payload: v.strictObject({ 1230 1230 account_id: v.string(), 1231 - object: v.objectWithRest({ 1231 + object: v.strictObject({ 1232 1232 id: v.optional(v.pipe(v.union([ 1233 1233 v.number(), 1234 1234 v.string(), ··· 1244 1244 call_type: v.string(), 1245 1245 device_ip: v.string() 1246 1246 }, v.unknown()) 1247 - }, v.never()) 1248 - }, v.never()) 1249 - }, v.never())), 1247 + }) 1248 + }) 1249 + })), 1250 1250 path: v.optional(v.never()), 1251 1251 query: v.optional(v.never()) 1252 1252 }); 1253 1253 1254 1254 export const vSessionRecordingStoppedWebhookRequest = v.object({ 1255 - body: v.optional(v.objectWithRest({ 1255 + body: v.optional(v.strictObject({ 1256 1256 event: v.picklist([ 1257 1257 'session.recording_stopped' 1258 1258 ]), ··· 1261 1261 v.string(), 1262 1262 v.bigint() 1263 1263 ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1264 - payload: v.objectWithRest({ 1264 + payload: v.strictObject({ 1265 1265 account_id: v.string(), 1266 - object: v.objectWithRest({ 1266 + object: v.strictObject({ 1267 1267 session_id: v.string(), 1268 1268 session_name: v.string(), 1269 1269 session_key: v.string(), ··· 1273 1273 recording_start: v.optional(v.string()), 1274 1274 recording_end: v.optional(v.string()) 1275 1275 }) 1276 - }, v.never()) 1277 - }, v.never()) 1278 - }, v.never())), 1276 + }) 1277 + }) 1278 + })), 1279 1279 path: v.optional(v.never()), 1280 1280 query: v.optional(v.never()) 1281 1281 });
+24
packages/openapi-ts-tests/main/test/plugins/valibot/spec/objectAdditionalProperties/additional-properties.yaml
··· 63 63 properties: 64 64 name: 65 65 type: string 66 + 67 + # Object with additionalProperties set to false (no additional properties allowed) 68 + ObjectWithAdditionalPropertiesFalse: 69 + type: object 70 + properties: 71 + id: 72 + type: string 73 + count: 74 + type: integer 75 + additionalProperties: false 76 + 77 + # Object with nested object that has additionalProperties: false 78 + ObjectWithNestedAdditionalPropertiesFalse: 79 + type: object 80 + properties: 81 + membership: 82 + type: object 83 + properties: 84 + status: 85 + type: string 86 + enum: [approved, declined, pending] 87 + calendar_membership_tier_id: 88 + type: string 89 + additionalProperties: false
+64
packages/openapi-ts-tests/main/test/plugins/valibot/test/objectAdditionalProperties/additional-properties.test.ts
··· 247 247 } 248 248 }); 249 249 }); 250 + 251 + describe('ObjectWithAdditionalPropertiesFalse', () => { 252 + it('should accept object with only defined properties', () => { 253 + const input = { 254 + count: 42, 255 + id: 'abc123', 256 + }; 257 + const result = v.safeParse( 258 + generatedSchemas.vObjectWithAdditionalPropertiesFalse, 259 + input, 260 + ); 261 + expect(result.success).toBe(true); 262 + if (result.success) { 263 + expect(result.output).toEqual(input); 264 + } 265 + }); 266 + 267 + it('should reject object with additional properties', () => { 268 + const input = { 269 + count: 42, 270 + extra: 'not allowed', 271 + id: 'abc123', 272 + }; 273 + const result = v.safeParse( 274 + generatedSchemas.vObjectWithAdditionalPropertiesFalse, 275 + input, 276 + ); 277 + expect(result.success).toBe(false); 278 + }); 279 + }); 280 + 281 + describe('ObjectWithNestedAdditionalPropertiesFalse', () => { 282 + it('should accept object with correct nested properties', () => { 283 + const input = { 284 + membership: { 285 + calendar_membership_tier_id: 'tier_id', 286 + status: 'approved', 287 + }, 288 + }; 289 + const result = v.safeParse( 290 + generatedSchemas.vObjectWithNestedAdditionalPropertiesFalse, 291 + input, 292 + ); 293 + expect(result.success).toBe(true); 294 + if (result.success) { 295 + expect(result.output).toEqual(input); 296 + } 297 + }); 298 + 299 + it('should reject object with additional properties in nested object', () => { 300 + const input = { 301 + membership: { 302 + calendar_membership_tier_id: 'tier_id', 303 + extra: 'not allowed', 304 + status: 'approved', 305 + }, 306 + }; 307 + const result = v.safeParse( 308 + generatedSchemas.vObjectWithNestedAdditionalPropertiesFalse, 309 + input, 310 + ); 311 + expect(result.success).toBe(false); 312 + }); 313 + }); 250 314 });
+21
packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts
··· 73 73 resource: 'valibot.v', 74 74 }); 75 75 76 + // Handle additionalProperties: false (which becomes type: 'never' in IR) 77 + // Use v.strictObject() to forbid additional properties 78 + if ( 79 + schema.additionalProperties && 80 + typeof schema.additionalProperties === 'object' && 81 + schema.additionalProperties.type === 'never' 82 + ) { 83 + result.pipes = [ 84 + tsc.callExpression({ 85 + functionName: tsc.propertyAccessExpression({ 86 + expression: v.placeholder, 87 + name: identifiers.schemas.strictObject, 88 + }), 89 + parameters: [ 90 + ts.factory.createObjectLiteralExpression(properties, true), 91 + ], 92 + }), 93 + ]; 94 + return result as Omit<Ast, 'typeName'>; 95 + } 96 + 76 97 // Handle additionalProperties with a schema (not just true/false) 77 98 // This supports objects with dynamic keys (e.g., Record<string, T>) 78 99 if (