Class: Datadog::AppSec::Contrib::GraphQL::Integration

Inherits:
Object
  • Object
show all
Includes:
Integration
Defined in:
lib/datadog/appsec/contrib/graphql/integration.rb

Overview

Description of GraphQL integration

Constant Summary collapse

MINIMUM_VERSION =
Gem::Version.new('2.0.19')
AST_NODE_CLASS_NAMES =
{
  field: 'GraphQL::Language::Nodes::Field',
  directive: 'GraphQL::Language::Nodes::Directive',
  variable_identifier: 'GraphQL::Language::Nodes::VariableIdentifier',
  input_object: 'GraphQL::Language::Nodes::InputObject',
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Integration

included, register, registry

Class Method Details

.ast_node_classes_defined?Boolean

Returns:

  • (Boolean)


41
42
43
44
45
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 41

def self.ast_node_classes_defined?
  AST_NODE_CLASS_NAMES.all? do |_, class_name|
    Object.const_defined?(class_name)
  end
end

.auto_instrument?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 37

def self.auto_instrument?
  true
end

.compatible?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 33

def self.compatible?
  super && version >= MINIMUM_VERSION && ast_node_classes_defined?
end

.loaded?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 29

def self.loaded?
  !defined?(::GraphQL).nil?
end

.versionObject



25
26
27
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 25

def self.version
  Gem.loaded_specs['graphql'] && Gem.loaded_specs['graphql'].version
end

Instance Method Details

#patcherObject



47
48
49
# File 'lib/datadog/appsec/contrib/graphql/integration.rb', line 47

def patcher
  Patcher
end