What’s the point of input type in GraphQL?

From the spec: The GraphQL Object type (ObjectTypeDefinition)… is inappropriate for re‐use [as an input], because Object types can contain fields that define arguments or contain references to interfaces and unions, neither of which is appropriate for use as an input argument. For this reason, input objects have a separate type in the system. That’s … Read more

Apollo / GraphQl – Type must be Input type

From the spec: Fields may accept arguments to configure their behavior. These inputs are often scalars or enums, but they sometimes need to represent more complex values. A GraphQL Input Object defines a set of input fields; the input fields are either scalars, enums, or other input objects. This allows arguments to accept arbitrarily complex … Read more

Shouldn’t the login be a Query in GraphQL?

In the context of that example, login should be a Query instead of a Mutation assuming its resolver has no side-effects, at least according to the spec. However, there’s a couple of reasons you probably won’t see that done in the wild: If you’re implementing authentication, you’ll probably want to log your users’ account activity, … Read more

Auto-update of apollo client cache after mutation not affecting existing queries

From the docs: If a mutation updates a single existing entity, Apollo Client can automatically update that entity’s value in its cache when the mutation returns. To do so, the mutation must return the id of the modified entity, along with the values of the fields that were modified. Conveniently, mutations do this by default … Read more