graphql / graphql/graphql-spec

Add ARGUMENT in DirectiveLocation

Open
#931 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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.

1. schema type definition:
``` graphql
Type Query{
itemList(itemIds: [Int]): [Item]
}

Type Item{
id: ID
price: Int
}
```

2. `ARGUMENT` definition:
```graphql
directive @partition(size: Int) on ARGUMENT
```

3. use @partition in query:
```graphql
query getTooManyItemByIds(itemIds:[Int]){
itemList(itemIds:$itemIds @partition(size:5)){
id
price
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.