diff --git a/types/src/front/api_handlers/public/assistant.ts b/types/src/front/api_handlers/public/assistant.ts index e21f1cdf1dd3..2b6ff4f0ef56 100644 --- a/types/src/front/api_handlers/public/assistant.ts +++ b/types/src/front/api_handlers/public/assistant.ts @@ -1,17 +1,21 @@ import * as t from "io-ts"; -export const PublicPostMessagesRequestBodySchema = t.type({ - content: t.string, - mentions: t.array(t.type({ configurationId: t.string })), - context: t.type({ - timezone: t.string, - username: t.string, - fullName: t.union([t.string, t.null]), - email: t.union([t.string, t.null]), - profilePictureUrl: t.union([t.string, t.null]), +export const PublicPostMessagesRequestBodySchema = t.intersection([ + t.type({ + content: t.string, + mentions: t.array(t.type({ configurationId: t.string })), + context: t.type({ + timezone: t.string, + username: t.string, + fullName: t.union([t.string, t.null]), + email: t.union([t.string, t.null]), + profilePictureUrl: t.union([t.string, t.null]), + }), }), - isSync: t.union([t.boolean, t.undefined]), -}); + t.partial({ + isSync: t.boolean, + }), +]); export const PublicPostContentFragmentRequestBodySchema = t.type({ title: t.string, @@ -32,18 +36,20 @@ export const PublicPostContentFragmentRequestBodySchema = t.type({ ]), }); -export const PublicPostConversationsRequestBodySchema = t.type({ - title: t.union([t.string, t.null]), - visibility: t.union([ - t.literal("unlisted"), - t.literal("workspace"), - t.literal("deleted"), - t.literal("test"), - ]), - message: t.union([PublicPostMessagesRequestBodySchema, t.undefined]), - contentFragment: t.union([ - PublicPostContentFragmentRequestBodySchema, - t.undefined, - ]), - isSync: t.union([t.boolean, t.undefined]), -}); +export const PublicPostConversationsRequestBodySchema = t.intersection([ + t.type({ + title: t.union([t.string, t.null]), + visibility: t.union([ + t.literal("unlisted"), + t.literal("workspace"), + t.literal("deleted"), + t.literal("test"), + ]), + message: t.union([PublicPostMessagesRequestBodySchema, t.undefined]), + contentFragment: t.union([ + PublicPostContentFragmentRequestBodySchema, + t.undefined, + ]), + }), + t.partial({ isSync: t.union([t.boolean, t.undefined]) }), +]);