How to write better graphql schemas?

Hey Michel,

I created this schema for user,

User.key: string @index(exact) .
User.name: string @index(exact) .
User.username: string @index(exact) .
User.bio: string .
User.age: int .
User.location: geo @index(geo) .
User.dob: datetime .
User.tags: [string] .
User.cluster: uid @reverse .

type User {
    User.key
    User.name
    User.username
    User.bio
    User.age
	User.location
	User.dob
    User.tags
    User.cluster
}

I’m using dgraph with go, so I created a struct

type User struct {
	Uid      string      `json:"uid,omitempty"`
	DType    string      `json:"dgraph.type,omitempty"`
	Key      string      `json:"User.key,omitempty"`
	Name     string      `json:"User.name,omitempty"`
	Username string      `json:"User.username,omitempty"`
	Bio      string      `json:"User.bio,omitempty"`
	Age      int         `json:"User.age,omitempty"`
	Location Loc         `json:"User.location,omitempty"`
	Dob      time.Time   `json:"User.dob,omitempty"`
	Tags     []string    `json:"User.tags,omitempty"`
	Cluster  ClusterEdge `json:"User.cluster,omitempty"`
}

I don’t know whether this is the best way to write this schema or am I doing something wrong here, because I will have to create a new struct in go to handle data coming in the rest api request, or to send data back to client. Client can’t get keys like User.name in the api response, it will need name as key. Is there a better way to handle this in dgraph? I saw I can give alias to query like this:

query all($key: string) {
	user(func: eq(User.key, $key)) {
		uid
		key: User.key
		name: User.name
	}
 }

But still have to create a struct to set data in dgraph.