Module: ApolloFederation::Field

Includes:
HasDirectives
Defined in:
lib/apollo-federation/field.rb

Constant Summary collapse

VERSION_1_DIRECTIVES =
%i[external requires provides].freeze
VERSION_2_DIRECTIVES =
%i[shareable inaccessible override].freeze

Instance Attribute Summary

Attributes included from HasDirectives

#federation_directives

Instance Method Summary collapse

Methods included from HasDirectives

#add_directive

Instance Method Details

#initialize(*args, **kwargs, &block) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/apollo-federation/field.rb', line 13

def initialize(*args, **kwargs, &block)
  add_v1_directives(**kwargs)
  add_v2_directives(**kwargs)

  # Remove the custom kwargs
  kwargs = kwargs.delete_if do |k, _|
    VERSION_1_DIRECTIVES.include?(k) || VERSION_2_DIRECTIVES.include?(k)
  end

  # Pass on the default args:
  super(*args, **kwargs, &block)
end