Skip to content

Editorial: Clarify field aliases #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ These two queries are semantically identical:

Alias : Name :

By default, the key in the response object will use the field name
queried. However, you can define a different name by specifying an alias.
By default a field's response key in the response object will use that field's
name. However, you can define a different response key by specifying an alias.

In this example, we can fetch two profile pictures of different sizes and ensure
the resulting object will not have duplicate keys:
the resulting response object will not have duplicate keys:

```graphql example
{
Expand All @@ -470,7 +470,7 @@ the resulting object will not have duplicate keys:
}
```

Which returns the result:
which returns the result:

```json example
{
Expand All @@ -483,7 +483,7 @@ Which returns the result:
}
```

Since the top level of a query is a field, it also can be given an alias:
The fields at the top level of an operation can also be given an alias:

```graphql example
{
Expand All @@ -494,7 +494,7 @@ Since the top level of a query is a field, it also can be given an alias:
}
```

Returns the result:
which returns the result:

```json example
{
Expand All @@ -505,9 +505,6 @@ Returns the result:
}
```

A field's response key is its alias if an alias is provided, and it is
otherwise the field's name.


## Fragments

Expand Down