fix: add explicit schema for hidden challenges

This commit is contained in:
Oliver Eyton-Williams
2020-03-04 15:37:06 +01:00
committed by Mrugesh Mohapatra
parent b197f73881
commit 64c969a908

View File

@ -210,3 +210,41 @@ exports.onCreateBabelConfig = ({ actions }) => {
}
});
};
// Typically the schema can be inferred, but not when some challenges are
// skipped (at time of writing the Chinese only has responsive web design), so
// this makes the missing fields explicit.
exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = `
type ChallengeNode implements Node {
question: Question
videoId: String
required: ExternalFile
files: ChallengeFile
}
type Question {
text: String
answers: [String]
solution: Int
}
type ChallengeFile {
indexhtml: FileContents
indexjs: FileContents
indexjsx: FileContents
}
type ExternalFile {
link: String
src: String
}
type FileContents {
key: String
ext: String
name: String
contents: String
head: String
tail: String
}
`;
createTypes(typeDefs);
};