Field Aliases

Learn how to use GraphQL's field aliases.

We'll cover the following

Introduction of field aliases

Sometimes there’s a difference of opinion between what the schema designer decides to call a field and how the API user would like the results returned. This comes up especially with mutations since they commonly include verbs as part of their names.

So, our users probably don’t want their new menu item returned as createMenuItembut what can they do?

They can use a field alias. By preceding the field with another name and a colon (:). For example, they can write this to call the result, menuItem:

Get hands-on with 1400+ tech skills courses.