Last active
July 6, 2018 17:44
-
-
Save danielbdias/00d5f093b8d5b852f2735ca7f5609934 to your computer and use it in GitHub Desktop.
An example of a GraphQL Type in Javascript
This file contains hidden or 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
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