Created
December 9, 2017 14:41
-
-
Save DevNebulae/6cfbc2ec8ca32325639e72d0b41b6200 to your computer and use it in GitHub Desktop.
GraphQL circular dependencies gql tag
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
const TrackType = gql` | |
type Track { | |
albums: [Album!] | |
artists: [Artist!] | |
title: String! | |
} | |
` | |
export default () => [AlbumType, ArtistType, TrackType] |
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
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