参数
Arguments
(Argument list)
Argument
Name:Value
Fields are conceptually functions which return values, and occasionally accept arguments which alter their behavior. These arguments often map directly to function arguments within a GraphQL server’s implementation.
In this example, we want to query a specific user (requested via theid
argument) and their profile picture of a specificsize
:
{
user(id: 4) {
id
name
profilePic(size: 100)
}
}
Many arguments can exist for a given field:
{
user(id: 4) {
id
name
profilePic(width: 100, height: 50)
}
}
Arguments are unordered
Arguments may be provided in any syntactic order and maintain identical semantic meaning.
These two queries are semantically identical:
{
picture(width: 200, height: 100)
}
{
picture(height: 100, width: 200)
}