feat(curriculum): add inputType property to challenge schema (#63405)

This commit is contained in:
Huyen Nguyen
2025-11-04 01:49:15 -08:00
committed by GitHub
parent 0770db7c86
commit 22e346ddc9

View File

@@ -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(),