@@ -389,7 +389,10 @@ module.exports = (db, server, mailboxHandler) => {
389
389
path : Joi . string ( )
390
390
. required ( )
391
391
. description ( 'Full path of the mailbox, folders are separated by slashes, ends with the mailbox name (unicode string)' ) ,
392
- specialUse : Joi . string ( ) . required ( ) . description ( 'Either special use identifier or null. One of Drafts, Junk, Sent or Trash' ) ,
392
+ specialUse : Joi . string ( )
393
+ . required ( )
394
+ . example ( '\\Draft' )
395
+ . description ( 'Either special use identifier or null. One of Drafts, Junk, Sent or Trash' ) ,
393
396
modifyIndex : Joi . number ( ) . required ( ) . description ( 'Modification sequence number. Incremented on every change in the mailbox.' ) ,
394
397
subscribed : booleanSchema . required ( ) . description ( 'Mailbox subscription status. IMAP clients may unsubscribe from a folder.' ) ,
395
398
hidden : booleanSchema . required ( ) . description ( 'Is the folder hidden or not' ) ,
@@ -620,15 +623,33 @@ module.exports = (db, server, mailboxHandler) => {
620
623
) ;
621
624
622
625
server . del (
623
- '/users/:user/mailboxes/:mailbox' ,
626
+ {
627
+ path : '/users/:user/mailboxes/:mailbox' ,
628
+ summary : 'Delete a Mailbox' ,
629
+ tags : [ 'Mailboxes' ] ,
630
+ validationObjs : {
631
+ requestBody : { user : userId , mailbox : mailboxId } ,
632
+ queryParams : { sess : sessSchema , ip : sessIPSchema } ,
633
+ pathParams : { } ,
634
+ response : {
635
+ 200 : {
636
+ description : 'Success' ,
637
+ model : Joi . object ( {
638
+ success : successRes
639
+ } )
640
+ }
641
+ }
642
+ }
643
+ } ,
624
644
tools . responseWrapper ( async ( req , res ) => {
625
645
res . charSet ( 'utf-8' ) ;
626
646
627
- const schema = Joi . object ( ) . keys ( {
628
- user : Joi . string ( ) . hex ( ) . lowercase ( ) . length ( 24 ) . required ( ) ,
629
- mailbox : Joi . string ( ) . hex ( ) . lowercase ( ) . length ( 24 ) . required ( ) ,
630
- sess : sessSchema ,
631
- ip : sessIPSchema
647
+ const { pathParams, requestBody, queryParams } = req . route . spec . validationObjs ;
648
+
649
+ const schema = Joi . object ( {
650
+ ...pathParams ,
651
+ ...requestBody ,
652
+ ...queryParams
632
653
} ) ;
633
654
634
655
const result = schema . validate ( req . params , {
0 commit comments