diff --git a/client/gatsby-node.js b/client/gatsby-node.js index bd51d687ba..9aae9a774f 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -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); +};