Skip to content

Commit

Permalink
[FEATURE] Séparer les schémas d'éléments acceptés dans le stepper par…
Browse files Browse the repository at this point in the history
… rapport au component element (PIX-15063)

 #10431
  • Loading branch information
pix-service-auto-merge authored Oct 30, 2024
2 parents 0af5ac3 + f6b3705 commit d590694
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ const elementSchema = Joi.alternatives().conditional('.type', {
],
});

const stepperElementSchema = Joi.alternatives().conditional('.type', {
switch: [
{ is: 'download', then: downloadElementSchema },
{ is: 'image', then: imageElementSchema },
{ is: 'qcu', then: qcuElementSchema },
{ is: 'qcm', then: qcmElementSchema },
{ is: 'qrocm', then: qrocmElementSchema },
{ is: 'separator', then: separatorElementSchema },
{ is: 'text', then: textElementSchema },
{ is: 'video', then: videoElementSchema },
],
});

const componentElementSchema = Joi.object({
type: Joi.string().valid('element').required(),
element: elementSchema.required(),
Expand All @@ -51,7 +64,7 @@ const componentStepperSchema = Joi.object({
steps: Joi.array()
.items(
Joi.object({
elements: Joi.array().items(elementSchema).required(),
elements: Joi.array().items(stepperElementSchema).required(),
}),
)
.min(2)
Expand Down

0 comments on commit d590694

Please sign in to comment.