I'm new to GraphQL so I may be misusing the Aliases feature, but I added a unit test with what I think is a valid use of the aliases in the branch bug/graphql_aliases
I'm not sure where to go to fix this, but @jbaxleyiii suggested it might be in getRequests(…)
The easiest way to support this is to leverage graphql-anywhere
which also brings the added benefit of lowering the bundle size cost since its included with Apollo in 90% of uses.
Yeah that’s a great way to do all kinds of junk like handing fragments/directives/arguments as well!
This should work on master now thanks to #12!
I am stil having this issue with v0.2.4
, the aliases don't seem to work.
export const usersQuery = gql`
query Users {
users @rest(type: "User", path: "/admin/users") {
name
email
userId: user_id
}
}
`;
with a response of
[{
"name": "Foo",
"email": "[email protected]",
"user_id": 1234
}]
Still results in the following data:
console.log(props.data.users);
/*
[{
"name": "Foo",
"email": "[email protected]",
"user_id": 1234
}]
*/
Instead of
console.log(props.data.users);
/*
[{
"name": "Foo",
"email": "[email protected]",
"userId": 1234
}]
*/
@jbaxleyiii I just ran into the same thing as @petetnt -- aliases inside of an apollo-link-rest request are not working. Aliases at the outer-scope level do work, now.
Thanks @fbartho !
Most helpful comment
@jbaxleyiii I just ran into the same thing as @petetnt -- aliases inside of an apollo-link-rest request are not working. Aliases at the outer-scope level do work, now.