Last active
October 4, 2019 11:37
-
-
Save kamleshchandnani/d052e1f4088ffcb63df70c40391867e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gatsby-node.js in my project root | |
/** | |
* So this shows up the index field in the graphiql explorer but when queried returns null | |
* even though this is present in my mdx field. Seems like I need to define the resolver somewhere | |
* but couldn't connect the dots | |
*/ | |
exports.createSchemaCustomization = ({ actions, schema }) => { | |
const { createTypes } = actions; | |
createTypes(`type BlogPost implements Node @nodeInterface { | |
date: Date @dateformat | |
index: Int | |
}`); | |
createTypes( | |
schema.buildObjectType({ | |
name: `MdxBlogPost`, | |
fields: { | |
date: { type: `Date`, extensions: { dateformat: {} } }, | |
index: { type: `Int` } | |
}, | |
interfaces: [`Node`, `BlogPost`] | |
}) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment