Apollo-link-rest: Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions

Created on 31 Aug 2018  ·  2Comments  ·  Source: apollographql/apollo-link-rest

const restLink = new RestLink({
  uri: 'https://swapi.co/api/',
});

const client = new ApolloClient({
  link: restLink,
  cache: new InMemoryCache(),
});
const Query = gql`
  query luke($id: String!) {
    person(id: $id)
     @rest(type: "Person", path: "people/:id") {
      name
    }
  }
`;

Warning: Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions

What could be the problem?

[email protected]
[email protected]
[email protected]
[email protected]

question❔

Most helpful comment

You'll want to update to the new syntax to get rid of that warning:

 @rest(type: "Person", path: "people/:id") {

becomes

 @rest(type: "Person", path: "people/{args.id}") {

All 2 comments

You'll want to update to the new syntax to get rid of that warning:

 @rest(type: "Person", path: "people/:id") {

becomes

 @rest(type: "Person", path: "people/{args.id}") {

great answer @dbryand!

Was this page helpful?
0 / 5 - 0 ratings