Repository navigation
Conversation
Codecov Report
@@ Coverage Diff @@
## master #404 +/- ##
==========================================
+ Coverage 19.34% 24.42% +5.08%
==========================================
Files 11 21 +10
Lines 2766 3132 +366
==========================================
+ Hits 535 765 +230
- Misses 2193 2305 +112
- Partials 38 62 +24
Continue to review full report at Codecov.
|
|
@srgyrn That you very much for raising this PR! Given the sheer size I will need a few days to properly review it. |
|
@reflog I'm wondering if you are interested in also reviewing this PR as your worked with GraphQL in the past IIRC. |
|
@srgyrn thanks for your contribution! Thanks again! |
|
@reflog I was there when the ticket was created. The main problem is that for fetching all the needed information for the PRs and issues we now have to do 3 different calls for each open issue assigned. That can consume the easily the allowed rates and takes significant time to load. Using GraphQL potentially will solve this, since we are able to get the whole information we need in just one query. You can get a bit more of insight in the linked GH issue. |
|
@larkox - awesome. Thanks for the details. I'll get on the review |
|
@srgyrn question - what is the reason for implementing so many 'generic' graphql methods, when all we need to do is to construct a struct with proper tags, like: and execute it? |
|
Hey @reflog, Having worked in projects before which communicate with Elasticsearch without a client like Elastica, I've seen codebases end up getting polluted with so many, so long and sometimes redundant json queries. Also, using the structs expected by githubv4 within the project's code will make the project very dependent to this third party package. You can see in the example structs given in githubv4's repo, package specific data types like githubv4.String, githubv4.HTML or enums are used. So anyone who wants to contribute to the project will have to know and/or learn about them too. True, my suggested way makes query creating longer and involves more error checks than just writing down a struct. However, it leaves the project's dependency on a third party package just at the query builder bit. Creating scalar queries is all about copying and pasting names and values from the GraphQL Explorer. More complex queries (object, union...) is all about setting children in them. With the query builder, you don't need to worry about package specific data types at all once required ones are added to the decorator/scalartypes.go. The same thing goes for struct tags as well. You can simply add a new one with validations so there won't be an unnecessary call to the GraphQL API if an unexpected value is set. |
|
@srgyrn - in general, I agree with you. Having better abstractions is great for large projects. |
|
I really don't have any knowledge about GraphQL, but from a software design perspective - the tradeoff here is codebase size vs too many abstractions. For a big project that heavily uses GraphQL queries, it makes sense to write a low-level library to manage boilerplates in a proper way. But for a small project which uses GraphQL sparingly, I would lean towards using the structs to keep things simple and maintainable. There is a cost to more code that we add. That has more chance of bugs, more lines of code to maintain and debug. The benefits of additional code should outweigh these costs. I really don't have much context on the future direction that this plugin will take or how much more GraphQL might be used in future, so I will leave it to the plugin owners to take a call on that. @srgyrn - |
|
First of all, I love the work you've done here, and seeing the number of tests you made to cover it is amazing. Thank you very much Regarding the PR itself, I agree with you in the base, it's really useful to decouple third-party libraries and I like the idea but I also agree with the comment from other reviewers, this looks a little overkill for this plugin. If I may suggest I'd do something like this. Decouple the library using a service so we can mock that up and test it properly. You can also encapsulate the queries inside and in case the situation explodes as you said from past experiences we can connect a new "Client" and use the builder. Again I want to stress that I think this is amazing work and has a lot of effort poured into it. Thank you |
|
@reflog @agnivade @ethervoid Thank you for your time and feedback :) @ethervoid Shall I remove the query builder and integrate the package like the example you've suggested or close the PR? |
|
@srgyrn thank you! |
|
Agree with @reflog , you can work on this PR :) . Thank you! |
hanzei
left a comment
There was a problem hiding this comment.
Blocking on the discussion point above to get this out of my review queue.
Please ping me once the changes are in.
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
Can we get a consensus or proposal from the reviewers that will provide actionable items for the PR author. Thanks for your work, @srgyrn |
|
The suggested proposal is right here #404 (comment). |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
/update-branch |
|
Error trying to update the PR. |
Codecov Report
@@ Coverage Diff @@
## master #404 +/- ##
==========================================
+ Coverage 19.03% 20.21% +1.17%
==========================================
Files 11 13 +2
Lines 3173 3181 +8
==========================================
+ Hits 604 643 +39
+ Misses 2529 2495 -34
- Partials 40 43 +3
Continue to review full report at Codecov.
|
|
/update-branch |
|
Error trying to update the PR. |
|
@srgyrn Would you mind resolving the conflicts? Thanks! |


Summary
This pull request adds functionality to use Github GraphQL API and replaces REST API with GraphQL API where pull request details are retrieved.
The new graphql package communicates with GraphQL API via https://github.com/shurcooL/githubv4. Anything related to this third party package are encapsulated for decoupling reasons:
Ticket Link
#325