Feature request: Normalize auto alias

So when using @normalize to flatten your data currently you have to manually alias every member of the parent structure.

What you really want though is for this somehow to magically be taken care of for you.

Someone on the discord suggested this, which is not bad! I have no idea how hard this is to implement of course. :slight_smile:

query {
  n(func: type(Post)) @normalize(auto_alias: True) {
    uid
    name
    author {
      author.uid: uid
      author.name: name
    }
    comments {
      comments.comment: comment
      author {
        comments.author.uid: uid
        comments.author.name
      }
    }
  }
}
2 Likes

So the thought is if the normalize directive could be controlled with a property to auto alias every depth by adding a edge dotted notation without manually doing so. All the dev would have to add is the auto_alias:true ← whatever, and then all of the aliases would be generated at runtime.

query {
  n(func: type(Post)) @normalize(auto_alias: True) {
    uid
    name
    author {
      uid
      name
    }
    comments {
      comment
      author {
        uid
        name
      }
    }
  }
}