@@ -41,6 +41,19 @@ const elementSchema = Joi.alternatives().conditional('.type', {
41
41
] ,
42
42
} ) ;
43
43
44
+ const stepperElementSchema = Joi . alternatives ( ) . conditional ( '.type' , {
45
+ switch : [
46
+ { is : 'download' , then : downloadElementSchema } ,
47
+ { is : 'image' , then : imageElementSchema } ,
48
+ { is : 'qcu' , then : qcuElementSchema } ,
49
+ { is : 'qcm' , then : qcmElementSchema } ,
50
+ { is : 'qrocm' , then : qrocmElementSchema } ,
51
+ { is : 'separator' , then : separatorElementSchema } ,
52
+ { is : 'text' , then : textElementSchema } ,
53
+ { is : 'video' , then : videoElementSchema } ,
54
+ ] ,
55
+ } ) ;
56
+
44
57
const componentElementSchema = Joi . object ( {
45
58
type : Joi . string ( ) . valid ( 'element' ) . required ( ) ,
46
59
element : elementSchema . required ( ) ,
@@ -51,7 +64,7 @@ const componentStepperSchema = Joi.object({
51
64
steps : Joi . array ( )
52
65
. items (
53
66
Joi . object ( {
54
- elements : Joi . array ( ) . items ( elementSchema ) . required ( ) ,
67
+ elements : Joi . array ( ) . items ( stepperElementSchema ) . required ( ) ,
55
68
} ) ,
56
69
)
57
70
. min ( 2 )
0 commit comments