File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,11 @@ function parseObjectFields(
122122 directives . forEach ( ( dir ) => {
123123 if ( dir . name . value === 'listCost' ) {
124124 fieldAdded = true ;
125- if ( dir . arguments && dir . arguments [ 0 ] . value . kind === Kind . INT ) {
125+ if (
126+ dir . arguments &&
127+ dir . arguments [ 0 ] . value . kind === Kind . INT &&
128+ Number ( dir . arguments [ 0 ] . value . value ) >= 0
129+ ) {
126130 result . fields [ field ] = {
127131 resolveTo : listType . toString ( ) . toLocaleLowerCase ( ) ,
128132 weight : Number ( dir . arguments [ 0 ] . value . value ) ,
@@ -180,8 +184,8 @@ function parseObjectFields(
180184 }
181185 } ) ;
182186
183- // TODO: check for enforceUnbounded List
184- // if an unbounded list has no @listCost directive attached
187+ // throw an error if an unbounded list has no @listCost directive attached or slicing arguments
188+ // and the enforceBoundedLists configuration option is sent to true
185189 if ( fieldAdded === false && enforceBoundedLists ) {
186190 throw new Error (
187191 `ERROR: buildTypeWeights: Use directive @listCost(cost: Int!) on unbounded lists, or limit query results with ${ KEYWORDS } `
You can’t perform that action at this time.
0 commit comments