Skip to content

Instantly share code, notes, and snippets.

@DevNebulae
Created December 9, 2017 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevNebulae/6cfbc2ec8ca32325639e72d0b41b6200 to your computer and use it in GitHub Desktop.
Save DevNebulae/6cfbc2ec8ca32325639e72d0b41b6200 to your computer and use it in GitHub Desktop.
GraphQL circular dependencies gql tag
const TrackType = gql`
type Track {
albums: [Album!]
artists: [Artist!]
title: String!
}
`
export default () => [AlbumType, ArtistType, TrackType]
const TrackType = new GraphQLObjectType({
name: "Track",
fields: () => {
const AlbumType = require("./album").default
const ArtistType = require("./artist").default
return {
albums: {
description: "",
type: new GraphQLList(new GraphQLNonNull(AlbumType))
},
artists: {
description: "",
type: new GraphQLList(new GraphQLNonNull(ArtistType))
},
title: {
description: "",
type: new GraphQLNonNull(GraphQLString)
}
}
}
})
export default TrackType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment