File tree Expand file tree Collapse file tree 4 files changed +153
-141
lines changed Expand file tree Collapse file tree 4 files changed +153
-141
lines changed Original file line number Diff line number Diff line change 2020 "lodash.get" : " ^4.4.2"
2121 },
2222 "peerDependencies" : {
23- "graphql" : " ^0.13.2 "
23+ "graphql" : " ^14.0.0 "
2424 },
2525 "files" : [
2626 " dist" ,
3737 "devDependencies" : {
3838 "@types/assert" : " ^0.0.31" ,
3939 "@types/chai" : " ^4.1.4" ,
40- "@types/graphql" : " ^0.13.4 " ,
40+ "@types/graphql" : " ^14.0.0 " ,
4141 "@types/lodash.get" : " ^4.4.4" ,
4242 "@types/mocha" : " ^5.2.5" ,
4343 "chai" : " ^4.1.0" ,
4444 "eslint" : " ^5.4.0" ,
4545 "eslint-plugin-typescript" : " ^0.12.0" ,
46- "graphql" : " ^0.13.2 " ,
46+ "graphql" : " ^14.0.0 " ,
4747 "mocha" : " ^5.2.0" ,
4848 "rimraf" : " ^2.6.1" ,
4949 "ts-node" : " ^7.0.1" ,
Original file line number Diff line number Diff line change @@ -25,6 +25,15 @@ const rule = queryComplexity({
2525Define your schema and add the complexity directive:
2626
2727``` graphql
28+ directive @complexity (
29+ # The complexity value for the field
30+ value : Int ! ,
31+
32+ # Optional multipliers
33+ multipliers : [String ! ]
34+ ) on FIELD_DEFINITION
35+
36+
2837type Query {
2938 # Fixed complexity of 5
3039 someField : String @complexity (value : 5 )
Original file line number Diff line number Diff line change @@ -7,6 +7,16 @@ import {
77} from 'graphql' ;
88
99export default buildSchema ( `
10+ directive @cost(
11+ value: Int!,
12+ multipliers: [String!]
13+ ) on FIELD_DEFINITION
14+
15+ directive @complexity(
16+ value: Int!,
17+ multipliers: [String!]
18+ ) on FIELD_DEFINITION
19+
1020type Query {
1121 scalar: String @complexity(value: 5)
1222 negativeCostScalar: String @complexity(value: -20)
You can’t perform that action at this time.
0 commit comments