mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-24 11:03:36 -05:00
feat(curriculum): add language attribute validation for language superblocks (#63434)
This commit is contained in:
@@ -4,7 +4,8 @@ Joi.objectId = require('joi-objectid')(Joi);
|
||||
const { challengeTypes } = require('../../shared-dist/config/challenge-types');
|
||||
const {
|
||||
chapterBasedSuperBlocks,
|
||||
catalogSuperBlocks
|
||||
catalogSuperBlocks,
|
||||
languageSuperBlocks
|
||||
} = require('../../shared-dist/config/curriculum');
|
||||
const {
|
||||
availableCharacters,
|
||||
@@ -227,7 +228,11 @@ const schema = Joi.object().keys({
|
||||
}),
|
||||
forumTopicId: Joi.number(),
|
||||
id: Joi.objectId().required(),
|
||||
lang: Joi.string(),
|
||||
lang: Joi.string().when('superBlock', {
|
||||
is: languageSuperBlocks,
|
||||
then: Joi.valid('en-US', 'es', 'zh-CN').required(),
|
||||
otherwise: Joi.valid('en')
|
||||
}),
|
||||
instructions: Joi.string().when('challengeType', {
|
||||
is: [challengeTypes.pythonProject, challengeTypes.codeAllyCert],
|
||||
then: Joi.string().min(1).required(),
|
||||
|
||||
Reference in New Issue
Block a user