Skip to content

Instantly share code, notes, and snippets.

@kamleshchandnani
Last active October 4, 2019 11:37
Show Gist options
  • Save kamleshchandnani/d052e1f4088ffcb63df70c40391867e0 to your computer and use it in GitHub Desktop.
Save kamleshchandnani/d052e1f4088ffcb63df70c40391867e0 to your computer and use it in GitHub Desktop.
// 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