Fixes #848
This commit is contained in:
parent
144c773cd7
commit
900167d300
|
@ -63,7 +63,6 @@ impl<'ctx, 'a> Visitor<'ctx> for ComplexityCalculate<'ctx, 'a> {
|
|||
*self.complexity_stack.last_mut().unwrap() += n;
|
||||
}
|
||||
ComplexityType::Fn(f) => {
|
||||
if MetaTypeName::create(&meta_field.ty).is_list() {
|
||||
match f(
|
||||
ctx,
|
||||
self.variable_definition.unwrap(),
|
||||
|
@ -77,7 +76,6 @@ impl<'ctx, 'a> Visitor<'ctx> for ComplexityCalculate<'ctx, 'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -131,6 +129,11 @@ mod tests {
|
|||
todo!()
|
||||
}
|
||||
|
||||
#[graphql(complexity = "5 * child_complexity")]
|
||||
async fn obj2(&self) -> MyObj {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[graphql(complexity = "count * child_complexity")]
|
||||
#[allow(unused_variables)]
|
||||
async fn objs(&self, #[graphql(default_with = "5")] count: usize) -> Vec<MyObj> {
|
||||
|
@ -409,5 +412,13 @@ mod tests {
|
|||
}"#,
|
||||
20,
|
||||
);
|
||||
|
||||
check_complex(
|
||||
r#"
|
||||
query {
|
||||
obj2 { a b }
|
||||
}"#,
|
||||
10,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user