0
votes

If graphql query schema is like this:

user(user_id: Int): User

Will apollo run resolver if in query will be additional (email) argument not defined in query schema?

I want iterate arguments in resolver, but not sure if it possible to pollute them.

P.S. If there is documentation of how apollo parcing arguments, will appreciate.

1

1 Answers

1
votes

In GraphQL, a schema defines what fields are available to the client, including what arguments are available for that field and what the types of those arguments are. Any query submitted to a GraphQL service will first be validated before it's executed. If the query includes any extraneous arguments, it will fail validation and won't be executed. This is explained here in the spec:

Formal Specification

  • For each argument in the document
  • Let argumentName be the Name of argument.
  • Let argumentDefinition be the argument definition provided by the parent field or definition named argumentName.
  • argumentDefinition must exist.

Explanatory Text

Every argument provided to a field or directive must be defined in the set of possible arguments of that field or directive.

For a better idea of how GraphQL works, I would suggest taking at least a cursory look through the spec.