-
Notifications
You must be signed in to change notification settings - Fork 283
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
Add support for named GraphQL operations #57
base: main
Are you sure you want to change the base?
Conversation
291e061
to
a4a48d3
Compare
Thanks for the PR. I'll try to get to reviewing it, but it may not happen right away. I hope you don't mind continuing to use your fork in the meantime, and please let me know if you learn anything more about this API and approach as you use it. |
Sure, take your time! We are already using a fork in GitHub CLI. |
LGTM |
Can we perchance get this merged? GitHub CLI is using a fork of this and it is making things difficult w/r/t packaging the GitHub CLI in Fedora. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @dmitshur, are you happy with this PR?
I'm having a hard time getting this to work, but I am a golang novice so I'm not sure if it's something I'm doing wrong. It seems that |
@bdentino Apologies; the deserialization was never actually tested. I've mostly submitted it as a suggestion of a potential approach. I've just pushed a commit that deserializes to the correct struct. Try it out! |
This one would be nice to have merged. I think it is general GraphQL best practice to have operations named. |
+1 on merging this - i need this functionality |
+1 on merging this! |
@dmitshur any chance this could be merged soon? Atlassian will soon be requiring named operations for calls to their GraphQL APIs which will break our integrations and force us to maintain/use a fork of this or do something else. It sounds like from the comments here that this is well tested and ready to go. All responses from Atlassian's GraphQL API right now include: {
"errors": [
{
"message": "Warning : You MUST provide a query operation name. In the future operations without names will be banned.",
"extensions": {
"statusCode": 400,
"classification": "ExecutionAborted"
}
}
]
} Fortunately they still return the response data I'm asking for so I'm able to inspect the error and ignore it in this case, but that's an ugly band aid that won't last for very long. |
For purposes of both server-side metrics and stubbing of HTTP requests in client-side tests, we need all GraphQL operations to be named; e.g.
This library did not support any facilities to name queries. Furthermore, adding an extra name argument to current methods would compromise backwards compatibility. #12
This proposes a declarative, backwards-compatible interface for naming queries: