Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice for shared query subsets? #93

Closed
rnystrom opened this issue Jun 6, 2017 · 2 comments
Closed

Best practice for shared query subsets? #93

rnystrom opened this issue Jun 6, 2017 · 2 comments

Comments

@rnystrom
Copy link

rnystrom commented Jun 6, 2017

I'm using the GitHub GraphQL API + Apollo to query Issues and Pull Requests. Requesting both requires a different object, so I have two queries, which means Apollo creates two different queries: IssueQuery and PullRequestQuery.

I need to take these models and generate the same view models from them, and so far find it a little tedious to basically write the same code twice (sharing as many functions as possible) since both queries share the exact same types but are namespaced to the root query.

For example:

IssueQuery.Data.Repository.Issue.Label
vs
PullRequestQuery.Data.Repository.PullRequest.Label.

I can't use fragments since the IssueTimelineItem and PullRequestTimelineItem don't have any unions (right?).

Here is my issue query and pull request query.

I'm a GraphQL noob and just picking things up for the first time, also super impressed w/ this project and hoping to learn enough that I can contribute back to it.

@rnystrom
Copy link
Author

rnystrom commented Jun 6, 2017

Looks like I overlooked this type

@rnystrom rnystrom closed this as completed Jun 6, 2017
@ermik
Copy link

ermik commented Nov 12, 2018

Freetime has gone a long way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants