Simple Dgraph schema to GraphQL schema mapping doesn't work

Right, I understand. I did almost the same thing but I used triples instead of JSON with the set command that gets queried by graphql endpoints.

Here is my untested attempt:

{
  "set": [
    {
      "dgraph.type" : "Person",
      "Person.name": "Karthic",
      "Person.age": 28,
      "Person.follows": {
        "dgraph.type": "Person"
        "Person.name": "Jessica",
        "Person.age": 31
      }
    }
  ]
}

This in triple format would look like:

{
  set {
    _:person1 <dgraph.type> "Person" .
    _:person1 <Person.name> "Karthic" .
    _:person1 <Person.age> "28" .
    _:person1 <Person.follows> _:person2 .
    _:person2 <dgraph.type> "Person" .
    _:person2 <Person.name> "Jessica" .
    _:person2 <Person.age> "31" .
  }
}

You can learn more at https://graphql.dgraph.io/dgraph

Pay attention to the types.

It is possible to map graphql schema to align to Dgraph schema in the last part of that doc page.

2 Likes