graphql-spec
graphql-spec copied to clipboard
Add ARGUMENT in DirectiveLocation
I think it will be great if ARGUMENT
will be allowed in DirectiveLocation
, and ARGUMENT
means that user can user directive on argument in query.
That is the scene: we want to divide list argument into groups by size, and get the field value respectively, then merge the result into result list.
- schema type definition:
Type Query{
itemList(itemIds: [Int]): [Item]
}
Type Item{
id: ID
price: Int
}
-
ARGUMENT
definition:
directive @partition(size: Int) on ARGUMENT
- use @partition in query:
query getTooManyItemByIds(itemIds:[Int]){
itemList(itemIds:$itemIds @partition(size:5)){
id
price
}
}
+1 for the idea; but sample case is not good IMHO
Adding the ability to specify a directive on an input-object field (within the query document, not the input object field definition) would be useful as well.