feat (learn): Remove editable regions from seed code before displaying user's code (#39153)
* feat: pull editable region from markdown * test: update seed tests to reflect new schema * feat(curriculum): validate multi-file solutions * test: add editableRegionBoundaries to schema Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
fd7a8c0d5e
commit
8478e021bf
@ -3,6 +3,16 @@ Joi.objectId = require('joi-objectid')(Joi);
|
||||
|
||||
const { challengeTypes } = require('../../client/utils/challengeTypes');
|
||||
|
||||
const fileJoi = Joi.object().keys({
|
||||
key: Joi.string(),
|
||||
ext: Joi.string(),
|
||||
name: Joi.string(),
|
||||
head: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')],
|
||||
tail: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')],
|
||||
contents: [Joi.array().items(Joi.string().allow('')), Joi.string().allow('')],
|
||||
editableRegionBoundaries: [Joi.array().items(Joi.string().allow(''))]
|
||||
});
|
||||
|
||||
function getSchemaForLang(lang) {
|
||||
let schema = Joi.object().keys({
|
||||
block: Joi.string(),
|
||||
@ -20,25 +30,7 @@ function getSchemaForLang(lang) {
|
||||
otherwise: Joi.string().required()
|
||||
}),
|
||||
fileName: Joi.string(),
|
||||
files: Joi.array().items(
|
||||
Joi.object().keys({
|
||||
key: Joi.string(),
|
||||
ext: Joi.string(),
|
||||
name: Joi.string(),
|
||||
head: [
|
||||
Joi.array().items(Joi.string().allow('')),
|
||||
Joi.string().allow('')
|
||||
],
|
||||
tail: [
|
||||
Joi.array().items(Joi.string().allow('')),
|
||||
Joi.string().allow('')
|
||||
],
|
||||
contents: [
|
||||
Joi.array().items(Joi.string().allow('')),
|
||||
Joi.string().allow('')
|
||||
]
|
||||
})
|
||||
),
|
||||
files: Joi.array().items(fileJoi),
|
||||
guideUrl: Joi.string().uri({ scheme: 'https' }),
|
||||
videoUrl: Joi.string().allow(''),
|
||||
forumTopicId: Joi.number(),
|
||||
@ -72,6 +64,7 @@ function getSchemaForLang(lang) {
|
||||
})
|
||||
),
|
||||
solutions: Joi.array().items(Joi.string().optional()),
|
||||
solutionFiles: Joi.array().items(fileJoi),
|
||||
superBlock: Joi.string(),
|
||||
superOrder: Joi.number(),
|
||||
suborder: Joi.number(),
|
||||
|
Reference in New Issue
Block a user