graphql-validation-complexity
graphql-validation-complexity copied to clipboard
Change the cost of __typename
We'd need to adjust the cost of __typename for every type. Is there a quick way?
Hmm, I don't see a way to adjust the cost of __typename in the current API, actually. Do you have an idea for how this sort of API should look?
Maybe generic getCost and getCostFactor in the options object, which receives the field name or type. Not sure what's best.
const ComplexityLimitRule = createComplexityLimitRule(1000, {
scalarCost: 1,
// Maybe something like this:
getCost: (cost, field) => field === '__typename' ? MY_CUSTOM_COST : cost,
});