NAME
GraphQL::Houtou::Validation::NodeLimit - query field-count limit validator
SYNOPSIS
use GraphQL::Houtou::Validation::NodeLimit qw(check_query_nodes);
my $ast = GraphQL::Houtou::parse($query_string);
my @errors = check_query_nodes($ast, max_nodes => 5000);
DESCRIPTION
Caps the total number of field selections an operation resolves, so a breadth-flooded query (many aliases of the same field, optionally multiplied through repeated fragment spreads) cannot exhaust CPU and memory while staying under the depth limit. Fragment spreads are counted by expansion; a spread already on the current path is not re-counted (cycles are rejected separately by the main validator).
The default maximum is 10,000. Pass max_nodes => undef to disable the check. This is a coarse denial-of-service bound rather than a weighted complexity model.
FUNCTIONS
check_query_nodes($ast, %opts)
Accepts a parsed AST (arrayref of definition nodes) and an optional max_nodes. Returns a list of error hashrefs (empty when within the limit).