Skip to content

Commit dcb9f88

Browse files
committed
fix mailboxes endpoints' input and output types
1 parent c113752 commit dcb9f88

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/api/mailboxes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ module.exports = (db, server, mailboxHandler) => {
399399
.required()
400400
.description('Full path of the mailbox, folders are separated by slashes, ends with the mailbox name (unicode string)'),
401401
specialUse: Joi.string()
402+
.allow(null)
402403
.required()
403404
.example('\\Draft')
404405
.description('Either special use identifier or null. One of Drafts, Junk, Sent or Trash'),
@@ -409,8 +410,8 @@ module.exports = (db, server, mailboxHandler) => {
409410
retention: Joi.number().description(
410411
'Retention policy for this mailbox (in ms). If set then messages added to this mailbox will be automatically deleted after retention time.'
411412
),
412-
total: Joi.number().required().description('How many messages are stored in this mailbox'),
413-
unseen: Joi.number().required().description('How many unseen messages are stored in this mailbox')
413+
total: Joi.number().allow(null).required().description('How many messages are stored in this mailbox'),
414+
unseen: Joi.number().allow(null).required().description('How many unseen messages are stored in this mailbox')
414415
}).$_setFlag('objectName', 'GetMailboxResponse')
415416
}
416417
}

lib/schemas/response/mailboxes-schemas.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ const GetMailboxesResult = Joi.object({
88
id: mailboxId,
99
name: Joi.string().required().description('Name for the mailbox (unicode string)'),
1010
path: Joi.string().required().description('Full path of the mailbox, folders are separated by slashes, ends with the mailbox name (unicode string)'),
11-
specialUse: Joi.string().required().description('Either special use identifier or null. One of Drafts, Junk, Sent or Trash'),
11+
specialUse: Joi.string().allow(null).required().description('Either special use identifier or null. One of Drafts, Junk, Sent or Trash'),
1212
modifyIndex: Joi.number().required().description('Modification sequence number. Incremented on every change in the mailbox.'),
1313
subscribed: booleanSchema.required().description('Mailbox subscription status. IMAP clients may unsubscribe from a folder.'),
1414
retention: Joi.number().description(
1515
'Default retention policy for this mailbox (in ms). If set then messages added to this mailbox will be automatically deleted after retention time.'
1616
),
1717
hidden: booleanSchema.required().description('Is the folder hidden or not'),
1818
encryptMessages: booleanSchema.default(false).required().description('If true then messages in this mailbox are encrypted'),
19-
total: Joi.number().description('How many messages are stored in this mailbox'),
20-
unseen: Joi.number().description('How many unseen messages are stored in this mailbox'),
19+
total: Joi.number().allow(null).description('How many messages are stored in this mailbox'),
20+
unseen: Joi.number().allow(null).description('How many unseen messages are stored in this mailbox'),
2121
size: Joi.number().description('Total size of mailbox in bytes.')
2222
});
2323

0 commit comments

Comments
 (0)