Expand not allowed multiple times in same sub-query

Version: v21.12.0

Let’s say that we have this schema:

type Job  {
	id: ID! 
	description: String 
	title: String 

type Person  {
	name: String! 
	address: String 
	job: Job 
	id: ID 

If we try to get a Person using DQL, and use expand(_all_), the result won’t include the job field since it’s another type.

How can I tell DQL to expand all non-type fields and selectively expand my typed fields?


query(func: type(Person)) {
  expand(Job) {

The closest you can get is to either use expand(_all_){uid} to get all predicates and all edges with the UID included. Or expand(_all_)@filter(type(type1) OR type(type2)){uid} to get only the edges of specific types, but this filters out value predicates.

Read more here: https://dgraph.io/docs/query-language/expand-predicates/#filtering-during-expand

Yea, but I also need to expand the non-typed fields. The error in question doesn’t make any sense since the first expand(_all_) won’t expand any of the typed fields. It makes sense to use another expand with filters for it.