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

refactor: Use GraphQL variables instead of string templates #10926

Merged
merged 3 commits into from
Jul 27, 2021

Conversation

zharinov
Copy link
Collaborator

Changes:

String templates and query string manipulation are too fragile and prevent further refactoring.
It's more convenient to use variables.

Context:

Ref #8386

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How risky is this refactor? And are we sure there aren't graphql libraries to abstract some of this?

@zharinov
Copy link
Collaborator Author

I've checked query results and pagination, everything works same. I don't know about abstraction, we're mostly just using plain GraphQL in not so many places. The only abstraction is the pagination, but we already solved it (kind of).

@rarkins
Copy link
Collaborator

rarkins commented Jul 22, 2021

What about the variables used here. Is that your own abstraction or part of graphql?

@zharinov
Copy link
Collaborator Author

They're part of GraphQL specification and transported with the query in the same JSON object

@JamieMagee
Copy link
Contributor

Nice! octokit/graphql.js#2 is also a good summary of why this is a good idea.

@rarkins rarkins merged commit c20eff9 into renovatebot:main Jul 27, 2021
@rarkins rarkins deleted the refactor/graphql-variables branch July 27, 2021 06:50
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 25.59.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants