Btw, for future readers: removing the dgraph.type set in the preCommit function (in the gist) didn’t change the result – the query still sometimes returns a string and sometimes returns an array.
@MichelDiz I may have found a workaround, and I think this might mean there’s a bug. If I change my queries to:
query {
foo(func: type(Foo)) {
uid
bar {
uid <-- Added this
bar_name
}
}
}
the bar_name result in Pre-Commit is always a string:
Pre-commit
{
"foo": [
{
"uid": "0x19cb5b",
"bar": {
"uid": "0x19cb59",
"bar_name": "bar 3"
}
}
]
}
You’ll see a similar result if you remove bar_name entirely and just query bar { uid } or bar { count(bar_name) } – basically any time you specify only one predicate or function in the braces.