Graphql resolver complexity multiplier is never used
We have a code that increases query complexity depending on number of nodes being fetched - https://gitlab.com/gitlab-org/gitlab/blob/master/app/graphql/resolvers/base_resolver.rb#L21. For example for these two queries:
query {
project(fullPath: "h5bp/html5-boilerplate") {
issues(first: 1) {
edges {
node {
title
}
}
}
}
}
query {
project(fullPath: "h5bp/html5-boilerplate") {
issues(first: 100) {
edges {
node {
title
}
}
}
}
}
I would expect that complexity will be higher for the second query which fetches 100 issues. The problem is that it's same for both queries.
The problem is probably that field_complexity uses resolver_class
parameter to detect if a field uses a resolver. I think this parameter used to be passed in earlier versions of graphql-ruby, but now it seems to be always nil
, so we should ideally use a different check for resolvers.
Edited by Jan Provaznik