fix(multi): validate challenges correctly

This commit is contained in:
Oliver Eyton-Williams
2020-06-09 11:41:26 +02:00
committed by Mrugesh Mohapatra
parent 754a33970e
commit 3783ef118e

View File

@ -7,10 +7,14 @@ const fileJoi = Joi.object().keys({
key: Joi.string(), key: Joi.string(),
ext: Joi.string(), ext: Joi.string(),
name: Joi.string(), name: Joi.string(),
head: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')], editableRegionBoundaries: [Joi.array().items(Joi.number())],
tail: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')], path: Joi.string(),
contents: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')], error: Joi.empty(),
editableRegionBoundaries: [Joi.array().items(Joi.number())] head: Joi.string().allow(''),
tail: Joi.string().allow(''),
seed: Joi.string().allow(''),
contents: Joi.string().allow(''),
history: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')]
}); });
function getSchemaForLang(lang) { function getSchemaForLang(lang) {
@ -30,7 +34,12 @@ function getSchemaForLang(lang) {
otherwise: Joi.string().required() otherwise: Joi.string().required()
}), }),
fileName: Joi.string(), fileName: Joi.string(),
files: Joi.array().items(fileJoi), files: Joi.object().keys({
indexcss: fileJoi,
indexhtml: fileJoi,
indexjs: fileJoi,
indexjsx: fileJoi
}),
guideUrl: Joi.string().uri({ scheme: 'https' }), guideUrl: Joi.string().uri({ scheme: 'https' }),
videoUrl: Joi.string().allow(''), videoUrl: Joi.string().allow(''),
forumTopicId: Joi.number(), forumTopicId: Joi.number(),