From 34aadc8062dd7105ea95af760256ac2228d5830f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 22:03:43 +0000 Subject: [PATCH 1/3] Initial plan From 61cd5f8c4d3464c882ba9934e2f3ad370f0d60c0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 22:19:40 +0000 Subject: [PATCH 2/3] Fix Valibot additionalProperties: false handling Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com> --- .../plugins/valibot/default/valibot.gen.ts | 28 +- .../plugins/valibot/default/valibot.gen.ts | 28 +- .../validators-circular-ref-2/valibot.gen.ts | 8 +- .../3.1.x/webhooks/valibot.gen.ts | 452 +++++++++--------- .../additional-properties.yaml | 24 + .../additional-properties.test.ts | 64 +++ .../src/plugins/valibot/v1/toAst/object.ts | 21 + 7 files changed, 367 insertions(+), 258 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts index 593ab59d8..218d9f214 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts @@ -995,17 +995,17 @@ export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({ value: v.pipe(v.number(), v.integer()) }, v.pipe(v.number(), v.integer())); -export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ item: v.optional(v.boolean()), error: v.optional(v.union([ v.string(), v.null() ])), hasError: v.optional(v.pipe(v.boolean(), v.readonly())), - data: v.optional(v.record(v.string(), v.never())) -}, v.never()); + data: v.optional(v.strictObject({})) +}); -export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ item: v.optional(v.union([ v.string(), v.null() @@ -1015,7 +1015,7 @@ export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ v.null() ])), hasError: v.optional(v.pipe(v.boolean(), v.readonly())) -}, v.never()); +}); export const vOneOfAllOfIssue = v.union([ v.intersect([ @@ -1117,16 +1117,16 @@ export const vOneOfAllOfIssueWritable = v.union([ vGenericSchemaDuplicateIssue1SystemString ]); -export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ item: v.optional(v.boolean()), error: v.optional(v.union([ v.string(), v.null() ])), - data: v.optional(v.record(v.string(), v.never())) -}, v.never()); + data: v.optional(v.strictObject({})) +}); -export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ item: v.optional(v.union([ v.string(), v.null() @@ -1135,7 +1135,7 @@ export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRes v.string(), v.null() ])) -}, v.never()); +}); /** * This is a reusable parameter @@ -1144,12 +1144,12 @@ export const vSimpleParameter = v.string(); export const vCompositionWithOneOfAndProperties = v.intersect([ v.union([ - v.objectWithRest({ + v.strictObject({ foo: vSimpleParameter - }, v.never()), - v.objectWithRest({ + }), + v.strictObject({ bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 - }, v.never()) + }) ]), v.object({ baz: v.union([ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts index badfc0b76..77951dda9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts @@ -993,17 +993,17 @@ export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({ value: v.pipe(v.number(), v.integer()) }, v.pipe(v.number(), v.integer())); -export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ item: v.optional(v.boolean()), error: v.optional(v.union([ v.string(), v.null() ])), hasError: v.optional(v.pipe(v.boolean(), v.readonly())), - data: v.optional(v.record(v.string(), v.never())) -}, v.never()); + data: v.optional(v.strictObject({})) +}); -export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ item: v.optional(v.union([ v.string(), v.null() @@ -1013,7 +1013,7 @@ export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({ v.null() ])), hasError: v.optional(v.pipe(v.boolean(), v.readonly())) -}, v.never()); +}); export const vOneOfAllOfIssue = v.union([ v.intersect([ @@ -1121,16 +1121,16 @@ export const vOneOfAllOfIssueWritable = v.union([ vGenericSchemaDuplicateIssue1SystemString ]); -export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ item: v.optional(v.boolean()), error: v.optional(v.union([ v.string(), v.null() ])), - data: v.optional(v.record(v.string(), v.never())) -}, v.never()); + data: v.optional(v.strictObject({})) +}); -export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({ +export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ item: v.optional(v.union([ v.string(), v.null() @@ -1139,7 +1139,7 @@ export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRes v.string(), v.null() ])) -}, v.never()); +}); /** * This is a reusable parameter @@ -1148,12 +1148,12 @@ export const vSimpleParameter = v.string(); export const vCompositionWithOneOfAndProperties = v.intersect([ v.union([ - v.objectWithRest({ + v.strictObject({ foo: vSimpleParameter - }, v.never()), - v.objectWithRest({ + }), + v.strictObject({ bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 - }, v.never()) + }) ]), v.object({ baz: v.union([ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts index 379ce5cf3..6b7d816f9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts @@ -2,15 +2,15 @@ import * as v from 'valibot'; -export const vBar: v.GenericSchema = v.objectWithRest({ +export const vBar: v.GenericSchema = v.strictObject({ bar: v.union([ v.array(v.lazy(() => { return vBar; })), v.null() ]) -}, v.never()); +}); -export const vFoo = v.objectWithRest({ +export const vFoo = v.strictObject({ foo: vBar -}, v.never()); +}); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts index 3edb219c3..a043f19ae 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts @@ -3,16 +3,16 @@ import * as v from 'valibot'; export const vSessionUserPhoneCalloutRingingWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -24,7 +24,7 @@ export const vSessionUserPhoneCalloutRingingWebhookRequest = v.object({ session_key: v.string(), user_key: v.string(), host_id: v.string(), - participant: v.objectWithRest({ + participant: v.strictObject({ invitee_name: v.string(), phone_number: v.pipe(v.union([ v.number(), @@ -36,25 +36,25 @@ export const vSessionUserPhoneCalloutRingingWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserRoomSystemCalloutRingingWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -70,15 +70,15 @@ export const vSessionUserRoomSystemCalloutRingingWebhookRequest = v.object({ call_type: v.string(), device_ip: v.string() }, v.unknown()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingStartedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_started' ]), @@ -87,9 +87,9 @@ export const vSessionRecordingStartedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -99,15 +99,15 @@ export const vSessionRecordingStartedWebhookRequest = v.object({ recording_start: v.optional(v.string()), recording_end: v.optional(v.string()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingResumedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_resumed' ]), @@ -116,9 +116,9 @@ export const vSessionRecordingResumedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -128,15 +128,15 @@ export const vSessionRecordingResumedWebhookRequest = v.object({ recording_start: v.optional(v.string()), recording_end: v.optional(v.string()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionLiveStreamingStoppedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.live_streaming_stopped' ]), @@ -145,9 +145,9 @@ export const vSessionLiveStreamingStoppedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), @@ -168,15 +168,15 @@ export const vSessionLiveStreamingStoppedWebhookRequest = v.object({ }), date_time: v.pipe(v.string(), v.isoTimestamp()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStreamIngestionStoppedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.stream_ingestion_stopped' ]), @@ -185,9 +185,9 @@ export const vSessionStreamIngestionStoppedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), @@ -199,24 +199,24 @@ export const vSessionStreamIngestionStoppedWebhookRequest = v.object({ stream_url: v.string(), backup_stream_url: v.string() }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserRoomSystemCalloutRejectedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -232,15 +232,15 @@ export const vSessionUserRoomSystemCalloutRejectedWebhookRequest = v.object({ call_type: v.string(), device_ip: v.string() }, v.unknown()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionAlertWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.alert' ]), @@ -249,9 +249,9 @@ export const vSessionAlertWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), @@ -263,15 +263,15 @@ export const vSessionAlertWebhookRequest = v.object({ 'High CPU occupation', 'Call Reconnection' ])) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionSharingEndedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.sharing_ended' ]), @@ -280,18 +280,18 @@ export const vSessionSharingEndedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), - user: v.objectWithRest({ + user: v.strictObject({ id: v.string(), name: v.string(), user_key: v.optional(v.string()), - sharing_details: v.objectWithRest({ + sharing_details: v.strictObject({ content: v.picklist([ 'application', 'whiteboard', @@ -299,17 +299,17 @@ export const vSessionSharingEndedWebhookRequest = v.object({ 'unknown' ]), date_time: v.pipe(v.string(), v.isoTimestamp()) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingPausedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_paused' ]), @@ -318,9 +318,9 @@ export const vSessionRecordingPausedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -330,15 +330,15 @@ export const vSessionRecordingPausedWebhookRequest = v.object({ recording_start: v.optional(v.string()), recording_end: v.optional(v.string()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionEndedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.ended' ]), @@ -347,24 +347,24 @@ export const vSessionEndedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), start_time: v.pipe(v.string(), v.isoTimestamp()), end_time: v.pipe(v.string(), v.isoTimestamp()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStartedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.started' ]), @@ -373,23 +373,23 @@ export const vSessionStartedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), start_time: v.pipe(v.string(), v.isoTimestamp()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStreamIngestionUnbindWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.stream_ingestion_unbind' ]), @@ -398,9 +398,9 @@ export const vSessionStreamIngestionUnbindWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), @@ -412,15 +412,15 @@ export const vSessionStreamIngestionUnbindWebhookRequest = v.object({ stream_url: v.string(), backup_stream_url: v.string() }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionLiveStreamingStartedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.live_streaming_started' ]), @@ -429,9 +429,9 @@ export const vSessionLiveStreamingStartedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), @@ -452,24 +452,24 @@ export const vSessionLiveStreamingStartedWebhookRequest = v.object({ }), date_time: v.pipe(v.string(), v.isoTimestamp()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserRoomSystemCalloutMissedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -485,24 +485,24 @@ export const vSessionUserRoomSystemCalloutMissedWebhookRequest = v.object({ call_type: v.string(), device_ip: v.string() }, v.unknown()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserPhoneCalloutAcceptedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -514,7 +514,7 @@ export const vSessionUserPhoneCalloutAcceptedWebhookRequest = v.object({ session_key: v.string(), user_key: v.string(), host_id: v.string(), - participant: v.objectWithRest({ + participant: v.strictObject({ invitee_name: v.string(), phone_number: v.pipe(v.union([ v.number(), @@ -526,16 +526,16 @@ export const vSessionUserPhoneCalloutAcceptedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserLeftWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.user_left' ]), @@ -544,14 +544,14 @@ export const vSessionUserLeftWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), - user: v.objectWithRest({ + user: v.strictObject({ id: v.string(), name: v.string(), leave_time: v.pipe(v.string(), v.isoTimestamp()), @@ -559,16 +559,16 @@ export const vSessionUserLeftWebhookRequest = v.object({ user_key: v.optional(v.string()), phone_number: v.optional(v.string()), participant_uuid: v.string() - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionSharingStartedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.sharing_started' ]), @@ -577,18 +577,18 @@ export const vSessionSharingStartedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), - user: v.objectWithRest({ + user: v.strictObject({ id: v.string(), name: v.string(), user_key: v.optional(v.string()), - sharing_details: v.objectWithRest({ + sharing_details: v.strictObject({ content: v.picklist([ 'application', 'whiteboard', @@ -596,31 +596,31 @@ export const vSessionSharingStartedWebhookRequest = v.object({ 'unknown' ]), date_time: v.pipe(v.string(), v.isoTimestamp()) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserPhoneCalloutCanceledWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), user_key: v.string(), - participant: v.objectWithRest({ + participant: v.strictObject({ invitee_name: v.string(), phone_number: v.pipe(v.union([ v.number(), @@ -632,16 +632,16 @@ export const vSessionUserPhoneCalloutCanceledWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingTranscriptCompletedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_transcript_completed' ]), @@ -651,9 +651,9 @@ export const vSessionRecordingTranscriptCompletedWebhookRequest = v.object({ v.bigint() ]), 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')), download_token: v.string(), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -710,15 +710,15 @@ export const vSessionRecordingTranscriptCompletedWebhookRequest = v.object({ 'chat_message' ])) })) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingDeletedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_deleted' ]), @@ -727,34 +727,34 @@ export const vSessionRecordingDeletedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), operator: v.pipe(v.string(), v.email()), operator_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), start_time: v.pipe(v.string(), v.isoTimestamp()), timezone: v.string() - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserRoomSystemCalloutFailedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -771,15 +771,15 @@ export const vSessionUserRoomSystemCalloutFailedWebhookRequest = v.object({ call_type: v.string(), device_ip: v.string() }, v.unknown()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingCompletedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_completed' ]), @@ -789,9 +789,9 @@ export const vSessionRecordingCompletedWebhookRequest = v.object({ v.bigint() ]), 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')), download_token: v.string(), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -923,15 +923,15 @@ export const vSessionRecordingCompletedWebhookRequest = v.object({ user_id: v.optional(v.string()), user_key: v.optional(v.string()) }))) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingTranscriptFailedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_transcript_failed' ]), @@ -940,23 +940,23 @@ export const vSessionRecordingTranscriptFailedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), start_time: v.pipe(v.string(), v.isoTimestamp()), timezone: v.string() - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingTrashedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_trashed' ]), @@ -965,25 +965,25 @@ export const vSessionRecordingTrashedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), operator: v.pipe(v.string(), v.email()), operator_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), start_time: v.pipe(v.string(), v.isoTimestamp()), timezone: v.string() - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserJoinedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.user_joined' ]), @@ -992,30 +992,30 @@ export const vSessionUserJoinedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.string(), session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), - user: v.objectWithRest({ + user: v.strictObject({ id: v.string(), name: v.string(), join_time: v.pipe(v.string(), v.isoTimestamp()), user_key: v.optional(v.string()), phone_number: v.optional(v.string()), participant_uuid: v.string() - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStreamIngestionStartedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.stream_ingestion_started' ]), @@ -1024,9 +1024,9 @@ export const vSessionStreamIngestionStartedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), @@ -1038,15 +1038,15 @@ export const vSessionStreamIngestionStartedWebhookRequest = v.object({ stream_url: v.string(), backup_stream_url: v.string() }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStreamIngestionConnectedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.stream_ingestion_connected' ]), @@ -1055,9 +1055,9 @@ export const vSessionStreamIngestionConnectedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), @@ -1069,15 +1069,15 @@ export const vSessionStreamIngestionConnectedWebhookRequest = v.object({ stream_url: v.string(), backup_stream_url: v.string() }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionStreamIngestionDisconnectedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.stream_ingestion_disconnected' ]), @@ -1086,9 +1086,9 @@ export const vSessionStreamIngestionDisconnectedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.optional(v.string()), @@ -1100,15 +1100,15 @@ export const vSessionStreamIngestionDisconnectedWebhookRequest = v.object({ stream_url: v.string(), backup_stream_url: v.string() }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingRecoveredWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_recovered' ]), @@ -1117,34 +1117,34 @@ export const vSessionRecordingRecoveredWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), operator: v.pipe(v.string(), v.email()), operator_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), start_time: v.pipe(v.string(), v.isoTimestamp()), timezone: v.string() - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserPhoneCalloutMissedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -1156,7 +1156,7 @@ export const vSessionUserPhoneCalloutMissedWebhookRequest = v.object({ session_key: v.string(), user_key: v.string(), host_id: v.string(), - participant: v.objectWithRest({ + participant: v.strictObject({ invitee_name: v.string(), phone_number: v.pipe(v.union([ v.number(), @@ -1168,25 +1168,25 @@ export const vSessionUserPhoneCalloutMissedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserPhoneCalloutRejectedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -1198,7 +1198,7 @@ export const vSessionUserPhoneCalloutRejectedWebhookRequest = v.object({ session_key: v.string(), user_key: v.string(), host_id: v.string(), - participant: v.objectWithRest({ + participant: v.strictObject({ invitee_name: v.string(), phone_number: v.pipe(v.union([ v.number(), @@ -1210,25 +1210,25 @@ export const vSessionUserPhoneCalloutRejectedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')) - }, v.never()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionUserRoomSystemCalloutAcceptedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.string(), event_ts: v.pipe(v.union([ v.number(), v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ id: v.optional(v.pipe(v.union([ v.number(), v.string(), @@ -1244,15 +1244,15 @@ export const vSessionUserRoomSystemCalloutAcceptedWebhookRequest = v.object({ call_type: v.string(), device_ip: v.string() }, v.unknown()) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); export const vSessionRecordingStoppedWebhookRequest = v.object({ - body: v.optional(v.objectWithRest({ + body: v.optional(v.strictObject({ event: v.picklist([ 'session.recording_stopped' ]), @@ -1261,9 +1261,9 @@ export const vSessionRecordingStoppedWebhookRequest = v.object({ v.string(), v.bigint() ]), 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')), - payload: v.objectWithRest({ + payload: v.strictObject({ account_id: v.string(), - object: v.objectWithRest({ + object: v.strictObject({ session_id: v.string(), session_name: v.string(), session_key: v.string(), @@ -1273,9 +1273,9 @@ export const vSessionRecordingStoppedWebhookRequest = v.object({ recording_start: v.optional(v.string()), recording_end: v.optional(v.string()) }) - }, v.never()) - }, v.never()) - }, v.never())), + }) + }) + })), path: v.optional(v.never()), query: v.optional(v.never()) }); diff --git a/packages/openapi-ts-tests/main/test/plugins/valibot/spec/objectAdditionalProperties/additional-properties.yaml b/packages/openapi-ts-tests/main/test/plugins/valibot/spec/objectAdditionalProperties/additional-properties.yaml index c4cb7494f..6698c4f84 100644 --- a/packages/openapi-ts-tests/main/test/plugins/valibot/spec/objectAdditionalProperties/additional-properties.yaml +++ b/packages/openapi-ts-tests/main/test/plugins/valibot/spec/objectAdditionalProperties/additional-properties.yaml @@ -63,3 +63,27 @@ components: properties: name: type: string + + # Object with additionalProperties set to false (no additional properties allowed) + ObjectWithAdditionalPropertiesFalse: + type: object + properties: + id: + type: string + count: + type: integer + additionalProperties: false + + # Object with nested object that has additionalProperties: false + ObjectWithNestedAdditionalPropertiesFalse: + type: object + properties: + membership: + type: object + properties: + status: + type: string + enum: [approved, declined, pending] + calendar_membership_tier_id: + type: string + additionalProperties: false diff --git a/packages/openapi-ts-tests/main/test/plugins/valibot/test/objectAdditionalProperties/additional-properties.test.ts b/packages/openapi-ts-tests/main/test/plugins/valibot/test/objectAdditionalProperties/additional-properties.test.ts index c652b599f..a4b0826db 100644 --- a/packages/openapi-ts-tests/main/test/plugins/valibot/test/objectAdditionalProperties/additional-properties.test.ts +++ b/packages/openapi-ts-tests/main/test/plugins/valibot/test/objectAdditionalProperties/additional-properties.test.ts @@ -247,4 +247,68 @@ describe('Object Additional Properties Tests', () => { } }); }); + + describe('ObjectWithAdditionalPropertiesFalse', () => { + it('should accept object with only defined properties', () => { + const input = { + count: 42, + id: 'abc123', + }; + const result = v.safeParse( + generatedSchemas.vObjectWithAdditionalPropertiesFalse, + input, + ); + expect(result.success).toBe(true); + if (result.success) { + expect(result.output).toEqual(input); + } + }); + + it('should reject object with additional properties', () => { + const input = { + count: 42, + extra: 'not allowed', + id: 'abc123', + }; + const result = v.safeParse( + generatedSchemas.vObjectWithAdditionalPropertiesFalse, + input, + ); + expect(result.success).toBe(false); + }); + }); + + describe('ObjectWithNestedAdditionalPropertiesFalse', () => { + it('should accept object with correct nested properties', () => { + const input = { + membership: { + calendar_membership_tier_id: 'tier_id', + status: 'approved', + }, + }; + const result = v.safeParse( + generatedSchemas.vObjectWithNestedAdditionalPropertiesFalse, + input, + ); + expect(result.success).toBe(true); + if (result.success) { + expect(result.output).toEqual(input); + } + }); + + it('should reject object with additional properties in nested object', () => { + const input = { + membership: { + calendar_membership_tier_id: 'tier_id', + extra: 'not allowed', + status: 'approved', + }, + }; + const result = v.safeParse( + generatedSchemas.vObjectWithNestedAdditionalPropertiesFalse, + input, + ); + expect(result.success).toBe(false); + }); + }); }); diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts index 1a533ec5c..42f74911e 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts @@ -73,6 +73,27 @@ export const objectToAst = ({ resource: 'valibot.v', }); + // Handle additionalProperties: false (which becomes type: 'never' in IR) + // Use v.strictObject() to forbid additional properties + if ( + schema.additionalProperties && + typeof schema.additionalProperties === 'object' && + schema.additionalProperties.type === 'never' + ) { + result.pipes = [ + tsc.callExpression({ + functionName: tsc.propertyAccessExpression({ + expression: v.placeholder, + name: identifiers.schemas.strictObject, + }), + parameters: [ + ts.factory.createObjectLiteralExpression(properties, true), + ], + }), + ]; + return result as Omit; + } + // Handle additionalProperties with a schema (not just true/false) // This supports objects with dynamic keys (e.g., Record) if ( From 3786d2b3b2316ddcc00b7d87f7dff15b61e29719 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sat, 8 Nov 2025 10:38:57 +0800 Subject: [PATCH 3/3] Create nine-cups-carry.md --- .changeset/nine-cups-carry.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nine-cups-carry.md diff --git a/.changeset/nine-cups-carry.md b/.changeset/nine-cups-carry.md new file mode 100644 index 000000000..f68d760ee --- /dev/null +++ b/.changeset/nine-cups-carry.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +valibot: use `.strictObject()` instead of `.objectWithRest()` when additional properties are not allowed