Complete the code to define a GraphQL type for a user with an ID.
type User { id: [1] }The ID scalar type is used to represent unique identifiers in GraphQL schemas, improving usability by clearly indicating unique keys.
Complete the code to make the 'name' field required in the User type.
type User { name: [1] }Adding an exclamation mark ! after the type makes the field non-nullable, ensuring the 'name' must always have a value, which improves schema usability.
Fix the error in the query by completing the field name correctly.
{ user(id: "1") { [1] } }The schema defines the user's name field as name. Using the correct field name ensures the query returns the expected data.
Fill both blanks to define a query that fetches a list of users with their IDs and names.
type Query { users: [1] { id: [2] } }The query returns a list of users, so the type is a list [User]. The id field uses the ID scalar type for unique identification.
Fill all three blanks to define a mutation that creates a user with a required name and returns the user's ID.
type Mutation { createUser(name: [1]): [2] { id: [3] } }The mutation requires a non-nullable String! for the name, returns a User type, and the id field is of type ID.