Sha256: cb3188f652f48a69d8334f148880ab75ecb10a678ef1405b6a6a951c2b5f5929
Contents?: true
Size: 737 Bytes
Versions: 19
Compression:
Stored size: 737 Bytes
Contents
# frozen_string_literal: true module GraphQL module Analysis module AST class FieldUsage < Analyzer def initialize(query) super @used_fields = Set.new @used_deprecated_fields = Set.new end def on_leave_field(node, parent, visitor) field_defn = visitor.field_definition field = "#{visitor.parent_type_definition.name}.#{field_defn.name}" @used_fields << field @used_deprecated_fields << field if field_defn.deprecation_reason end def result { used_fields: @used_fields.to_a, used_deprecated_fields: @used_deprecated_fields.to_a } end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems