对象字段的参数
Object fields are conceptually functions which yield values. Occasionally object fields can accept arguments to further specify the return value. Object field arguments are defined as a list of all possible argument names and their expected input types.
All arguments defined within a field must not have a name which begins with"__"(two underscores), as this is used exclusively by GraphQL’s introspection system.
For example, aPerson
type with apicture
field could accept an argument to determine what size of an image to return.
type Person {
name: String
picture(size: Int): Url
}
GraphQL queries can optionally specify arguments to their fields to provide these arguments.
This example query:
{
name
picture(size: 600)
}
May yield the result:
{
"name":"Mark Zuckerberg",
"picture":"http://some.cdn/picture_600.jpg"
}
The type of an object field argument can be any Input type.