githubv4 icon indicating copy to clipboard operation
githubv4 copied to clipboard

Is it possible to dynamically include graphql fields?

Open patrickdevivo opened this issue 3 years ago • 1 comments

Hi all!

I'm wondering if it's possible to use this library in a way that "dynamically" sets what GraphQL fields are used in a query (in the actual request to the GitHub API).

By "dynamic" I mean a way of specifying at runtime what fields to include in a request. For my use case, I'd actually be more interested in excluding fields under certain conditions 😃 .

For context, I maintain this project, which uses this library to implement the GitHub tables. We often hit GitHub's GraphQL API rate limit - which I believe is related to the number of fields/connections we request.

We have the ability to know, in our SQL query, which columns (GraphQL fields) are actually needed/requested by the user, so if we could only send those in the request to the GitHub API, that would probably allow us to avoid hitting the rate limit as frequently.

Is this possible today?

patrickdevivo avatar Dec 08 '21 21:12 patrickdevivo

I think you look for something similar to this: https://github.com/shurcooL/githubv4/issues/17#issuecomment-437646874

jmguzik avatar Dec 13 '21 22:12 jmguzik