From 07cf7e3e7228ee43ea9e70520b0b4b137c86c75e Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Wed, 9 Sep 2020 19:22:20 +0200 Subject: [PATCH] fix(client): set custom schema Necessary for the time being, as all the multi-file challenges are upcoming (and thus hidden) --- client/gatsby-node.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/client/gatsby-node.js b/client/gatsby-node.js index 423d79e86a..bf3b034838 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -216,8 +216,34 @@ exports.onCreatePage = async ({ page, actions }) => { } }; +exports.createSchemaCustomization = ({ actions }) => { + const { createTypes } = actions; + const typeDefs = ` + type ChallengeNode implements Node { + files: ChallengeFile + } + type ChallengeFile { + indexcss: FileContents + indexhtml: FileContents + indexjs: FileContents + indexjsx: FileContents + } + type FileContents { + key: String + ext: String + name: String + contents: String + head: String + tail: String + editableRegionBoundaries: [Int] + } + `; + createTypes(typeDefs); +}; + // TODO: this broke the React challenges, not sure why, but I'll investigate // further and reimplement if it's possible and necessary (Oliver) +// I'm still not sure why, but the above schema seems to work. // 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.