nameWithArguments
Returns a String containing the name of this field as well as encoded arguments. For an example: hero({"episode": "Jedi"})
This is mostly used internally to compute field keys / cache keys.
Note1:
The argument defaultValues are not added to the name. If the schema changes from:
type Query {
users(first: Int = 10): [User]
}
Content copied to clipboard
to:
type Query {
users(first: Int = 10_000): [User]
}
Content copied to clipboard
The nameWithArguments will stay "users" in both cases.
Note2:
While the defaultValues of variables are taken into account, the variables are not fully coerced. These 2 queries will have different cache keys despite being identical:
Query1:
query GetUsers($ids: [ID]) {
users(ids: $ids) { id }
}
Content copied to clipboard
Variables1:
{
"ids": [42]
}
Content copied to clipboard
CacheKey1: users({"ids": ["42"]})
Variables2, coercing a single item to a list:
{
"ids": 42
}
Content copied to clipboard
CacheKey1: users({"ids": 42})