Skip to content

Instantly share code, notes, and snippets.

@danielbdias
Last active July 6, 2018 17:44
Show Gist options
  • Save danielbdias/00d5f093b8d5b852f2735ca7f5609934 to your computer and use it in GitHub Desktop.
Save danielbdias/00d5f093b8d5b852f2735ca7f5609934 to your computer and use it in GitHub Desktop.
An example of a GraphQL Type in Javascript
const { GraphQLString,
GraphQLObjectType } = require(‘graphql’
)
const MyCustomType = new GraphQLObjectType({
name: ‘MyCustomType’,
description: ‘My custom type’,
fields: () => ({
myStringField: {
type: GraphQLString,
description: ‘A string field’
},
aCustomResolvedField: {
type: GraphQLString,
description: ‘A field with a custom resolve’,
resolve: record => record.innerValues.innerField
}
})
})
module.exports = MyCustomType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment