mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-29 16:00:55 -04:00
feat(curriculum): add inputType property to challenge schema (#63405)
This commit is contained in:
@@ -5,7 +5,8 @@ const { challengeTypes } = require('../../shared-dist/config/challenge-types');
|
||||
const {
|
||||
chapterBasedSuperBlocks,
|
||||
catalogSuperBlocks,
|
||||
languageSuperBlocks
|
||||
languageSuperBlocks,
|
||||
SuperBlocks
|
||||
} = require('../../shared-dist/config/curriculum');
|
||||
const {
|
||||
availableCharacters,
|
||||
@@ -233,6 +234,15 @@ const schema = Joi.object().keys({
|
||||
then: Joi.valid('en-US', 'es', 'zh-CN').required(),
|
||||
otherwise: Joi.forbidden()
|
||||
}),
|
||||
inputType: Joi.when('challengeType', {
|
||||
is: challengeTypes.fillInTheBlank,
|
||||
then: Joi.when('superBlock', {
|
||||
is: Joi.valid(SuperBlocks.A1Chinese, SuperBlocks.A2Chinese),
|
||||
then: Joi.string().valid('pinyin-tone', 'pinyin-to-hanzi').optional(),
|
||||
otherwise: Joi.forbidden()
|
||||
}),
|
||||
otherwise: Joi.forbidden()
|
||||
}),
|
||||
instructions: Joi.string().when('challengeType', {
|
||||
is: [challengeTypes.pythonProject, challengeTypes.codeAllyCert],
|
||||
then: Joi.string().min(1).required(),
|
||||
|
||||
Reference in New Issue
Block a user