Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to rename the field name to userName using an alias.
GraphQL
{ user { [1]: name } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the original field name instead of an alias.
Putting the alias after the field name.
Using invalid characters in the alias.
✗ Incorrect
In GraphQL, you can rename a field by writing
aliasName: originalFieldName. Here, userName: name renames name to userName.2fill in blank
mediumComplete the code to rename the field email to userEmail using an alias.
GraphQL
{ user { [1]: email } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the original field name without alias.
Using an alias that does not match the instruction.
✗ Incorrect
The alias
userEmail renames the email field to userEmail in the query result.3fill in blank
hardFix the error in the alias syntax to rename age to userAge.
GraphQL
{ user { [1] age } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing colon after alias.
Using double colons.
Placing colon before alias.
✗ Incorrect
The correct alias syntax requires the alias followed by a colon and then the field name. So
userAge: age is correct.4fill in blank
hardFill both blanks to rename firstName to first and lastName to last.
GraphQL
{ user { [1]: firstName, [2]: lastName } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping alias and field names.
Using original field names as aliases.
✗ Incorrect
Use aliases
first and last to rename firstName and lastName respectively.5fill in blank
hardFill all three blanks to rename id to userId, username to userName, and email to userEmail.
GraphQL
{ user { [1]: id, [2]: username, [3]: email } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using original field names instead of aliases.
Mixing up alias names.
✗ Incorrect
Each alias renames the original field to a new name:
userId, userName, and userEmail.