GraphQL: directive for GraphQL+- custom resolver (e.g Geolocation)

@abhimanyusinghgaur not sure if I got it.

e.g

type Query{
    getGeo(name: String!, v1: String!, v2: String!): GeoObject @custom(http:{
        url: "https://localhost:8080/query"
        method: "POST",
        body: "{ "query": "{ q(func: eq(name, \"$name\")) { uid  name } }, "variables": {"$a": $v1, "$b": $v2, "$name": $name }"}"
    })
}

Do you mean that we can’t pass the GraphQL variable to Dgraph’s GraphQL variable?

Feels like we don’t even would need to use it. Maybe it could be straightforward.
e.g:

type Query{
    getGeo(name: String!): GeoObject @custom(http:{
        url: "https://localhost:8080/query"
        method: "POST",
        body: "{ "query": "{ q(func: eq(name, $name)) { uid  name } } "}"
    })
}

That wouldn’t work?

Also, I don’t see many users using GraphQL Variables in Dgraph context - not sure if it is useful right now. It is used in GraphQL more tho.

2 Likes