0
0
GraphQLquery~10 mins

One-to-one relationships in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a one-to-one relationship field in GraphQL schema.

GraphQL
type User {
  id: ID!
  profile: [1]
}
Drag options to blanks, or click blank then click option'
AString
BProfile
C[Profile]
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list type like [Profile] which implies one-to-many.
Using scalar types like String or Int instead of the related type.
2fill in blank
medium

Complete the code to define the inverse one-to-one relationship field in the related type.

GraphQL
type Profile {
  id: ID!
  user: [1]
}
Drag options to blanks, or click blank then click option'
AUser
B[User]
CString
DID
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list type which implies multiple users.
Using scalar types instead of the related object type.
3fill in blank
hard

Fix the error in the GraphQL schema for one-to-one relationship by completing the field type.

GraphQL
type User {
  id: ID!
  profile: [1]
}

type Profile {
  id: ID!
  user: [User]
}
Drag options to blanks, or click blank then click option'
AProfile
B[Profile]
CString
DID
Attempts:
3 left
💡 Hint
Common Mistakes
Using list types which imply one-to-many relationships.
Using scalar types instead of object types.
4fill in blank
hard

Fill both blanks to complete the GraphQL schema for a one-to-one relationship with non-nullable fields.

GraphQL
type User {
  id: ID!
  profile: [1]!
}

type Profile {
  id: ID!
  user: [2]!
}
Drag options to blanks, or click blank then click option'
AProfile
B[Profile]
CUser
D[User]
Attempts:
3 left
💡 Hint
Common Mistakes
Using list types which imply multiple related objects.
Omitting the non-nullable marker !.
5fill in blank
hard

Fill all three blanks to complete the GraphQL schema with one-to-one relationship and ID references.

GraphQL
type User {
  id: [1]!
  profileId: [2]
  profile: [3]
}
Drag options to blanks, or click blank then click option'
AID
BString
CProfile
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Using scalar types like String or Int for IDs inconsistently.
Using list types for the related object.