diff --git a/curriculum/schema/challengeSchema.js b/curriculum/schema/challengeSchema.js index ee39562edb..865a5adf12 100644 --- a/curriculum/schema/challengeSchema.js +++ b/curriculum/schema/challengeSchema.js @@ -41,6 +41,7 @@ function getSchemaForLang(lang) { ), guideUrl: Joi.string().uri({ scheme: 'https' }), videoUrl: Joi.string().allow(''), + forumTopicId: Joi.number(), helpRoom: Joi.string(), id: Joi.objectId().required(), instructions: Joi.string().allow(''), diff --git a/tools/scripts/ci/ensure-challenge-formatting.js b/tools/scripts/ci/ensure-challenge-formatting.js index dbf06e3d00..cf6f455165 100644 --- a/tools/scripts/ci/ensure-challenge-formatting.js +++ b/tools/scripts/ci/ensure-challenge-formatting.js @@ -51,21 +51,26 @@ const challengeFrontmatterValidator = file => frontmatter => { `); } + const { videoUrl } = frontmatter; - let validVideoUrl = false; - if (isEmpty(videoUrl)) { + if (!isEmpty(videoUrl) && !scrimbaUrlRE.test(videoUrl)) { validVideoUrl = true; - } else { - validVideoUrl = scrimbaUrlRE.test(videoUrl); - - if (!validVideoUrl) { - console.log(` - ${fullPath} contains an invalid videoUrl -`); - } + console.log(` + ${fullPath} contains an invalid videoUrl + `); } - return hasRequiredProperties && validVideoUrl; + + const { forumTopicId } = frontmatter; + let validForumTopicId = false; + if (!isEmpty(forumTopicId) && !isNumber(forumTopicId)) { + validForumTopicId = true; + console.log(` + ${fullPath} contains an invalid forumTopicId + `); + } + + return hasRequiredProperties && validVideoUrl && validForumTopicId; }; function isChallengeParseable(file) {