acro5piano / graphql-rest-proxy

Turn your REST API into GraphQL - A Proxy Server that pipes request from GraphQL to REST with GraphQL DSL, performant nested children, mutations, input types, and more.

Home Page:https://www.npmjs.com/package/graphql-rest-proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only "&id" will be resolved

bruehldev opened this issue · comments

Hey Kay,

we noticed that only a variable called "&id" will be resolved. Other names of the variable are not working. We think the problem is here: https://github.com/acro5piano/graphql-rest-proxy/blob/master/src/directives/proxy.ts#L49

Best regards
Daniel

Hi Daniel,

Thank you for your interest in this project.
The behavior is intended to get a single resource from REST api.
However, I think it would be great if we can include any variables into both GraphQL and REST. If you implement it and open your PR I would merge it.

Thanks!!

@JuliPodie Thanks for your contribution! The feature was released on v0.7.0.

You are now able to use directive variables like this:

type Query {
  user(userId: Int!): User @proxy(get: "/users/$userId")
}

# Usage
query GetUserById {
  user(userId: 42) {
    id
    name
  }
}