wincent / masochist

⛓ Website infrastructure for over-engineers
MIT License
78 stars 26 forks source link

Unimported GraphQL types used in taggedInterface type #75

Closed ahmadferdous closed 7 years ago

ahmadferdous commented 8 years ago

First things first. I have been looking for open-source GraphQL, Relay projects that are more advanced that the example Relay projects. I happened to find this project of yours, while I was looking for a solution to split the GraphQL schema file of my project. I found your project very helpful. I came to know, for example, about dataloader library, which I'll try out.

Now, about the issue I noticed, the GraphQL types returned are not imported here: https://github.com/wincent/masochist/blob/515a71e141900679d8ac039a92db8b848310bab3/app/src/server/schema/interfaces/taggedInterface.js#L22-L28

I searched the code but could not find any match with the returned type names. For example, now there is ArticleType instead of articleType. It seems that taggedInterface included in the content types (article, page etc.), as in interfaces: [nodeInterface, taggedInterface] , are not actually used. The resolution from object to GraphQL type is used only for UserType. I think, that's why resolveType is not invoked.

wincent commented 8 years ago

Well spotted. I probably broke this around 95206df37bb5b6 (for the SnippetType/snippetType), and other nearby commits for the other types (eg. 51c0f6a126d9).

Your explanation of why resolveType never gets used sounds about right to me.

Disclaimer: I work on Relay, but this project was the first time I'd ever authored a GraphQL schema. I did it partly to get a feel for what that's like. So I wouldn't consider it an example of best practices or anything like that; it's just what I figured out.

wincent commented 7 years ago

Killed the code off in bdf8b68ffc96be6610255b3577cca72371796ce8.