I am creating a graphql API using typescript, type graphql, and dgraph using dgraphjs as the client. I’m trying to pass input for facet using graphql.
The documentation on facets mutation illustrates this usage:
{
"name": "Carol",
"name|initial": "C",
"dgraph.type": "Person",
"friend": {
"name": "Daryl",
"friend|close": "yes",
"dgraph.type": "Person"
}
}
However, graphql specification does not allow "friend|close": yes
as an input for a mutation because of allowed character in field name.
mutation {
createPerson(input: {
name: "Carol"
"name|initial": "C"
friends: [{
"name": "Daryl"
"friend|close": "yes"
}]
})
}
In this case facets will need to be renamed and handled internally in the resolver or service before calling dgraph client to translate graphql to dgraph so that facets are created and not attributes. I have intentionally ignored passing dgraph.type since that is easily handled using default values for graphql input types.
Is there another approach to doing this or is this even a recommended way of tackling this problem?