vscode-restclient
vscode-restclient copied to clipboard
GraphQL: Support Aliases for queries
In GraphQL playgrounds I can add an alias String to a query (or mutation, or ...). Copying multiple queries from the .http file to a playground results in syntax errors, unless I add the alias there. It would be nice to be able to have the alias support in the .http files too. This also self-documents the query, rather than by adding a comment.

Only one anonymous query allowed in playground

@docwarems is this what you want? https://github.com/Huachao/vscode-restclient/issues/919 If so, it's already supported in the latest version 0.24.6
It probably goes in this direction, but I cannot get it to work, see my comment there. Also what I need is a syntax that is compatible with popular browser GraphQL playgrounds, and I wonder if the proposed solutions satisfies that.
@docwarems I see the error you've posted in that issue. And it's a known issue, the workaround is removing the traling space between MyAlias and {. And your request should look similar as follows:
POST HTTP://localhost:8090/graphql
Content-Type: application/json
X-Request-Type: GraphQL
query MyAlias{
....
In the next release, you can write as you wish that keeps the space