Method: GraphQL::Analysis::QueryDepth#on_leave_field

Defined in:
lib/graphql/analysis/query_depth.rb

#on_leave_field(node, parent, visitor) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/graphql/analysis/query_depth.rb', line 42

def on_leave_field(node, parent, visitor)
  return if visitor.skipping? ||
    visitor.visiting_fragment_definition? ||
    (@count_introspection_fields == false && visitor.field_definition.introspection?)

  if @max_depth < @current_depth
    @max_depth = @current_depth
  end
  @current_depth -= 1
end