What are input types and how do they differ from regular types?

Beginner

Answer

Input types are used for arguments in mutations and queries. They can only contain scalars, enums, lists, and other input types.

input CreateUserInput {
  name: String!
  email: String!
  age: Int
}

input UpdateUserInput {
  name: String
  email: String
  age: Int
}

type Mutation {
  createUser(input: CreateUserInput!): User!
  updateUser(id: ID!, input: UpdateUserInput!): User!
}