Skip to main content

complexity

Example of custom directive for customDirective.

See documentation

directive @complexity(
value: Int!
multipliers: [String!]
) on FIELD_DEFINITION

Arguments

value ● Int! non-null scalar common

The level of complexity to resolve the current field.

If the field needs to call an expensive service to resolve itself, then the complexity should be at a high level but if the field is easy to resolve and not an expensive operation, the complexity should be at a low level.

multipliers ● [String!] list scalar common

An array containing names of parameters present in the GraphQL field.

Use parameters values to compute the field's cost dynamically. If the parameter is an array, its multiplier value will be the length of the array.