Method: GraphQL::Schema::FieldExtension#after_define_apply

Defined in:
lib/graphql/schema/field_extension.rb

#after_define_applyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/graphql/schema/field_extension.rb', line 92

def after_define_apply
  after_define
  if (configs = self.class.default_argument_configurations)
    existing_keywords = field.all_argument_definitions.map(&:keyword)
    existing_keywords.uniq!
    @added_default_arguments = []
    configs.each do |config|
      argument_args, argument_kwargs = config
      arg_name = argument_args[0]
      if !existing_keywords.include?(arg_name)
        @added_default_arguments << arg_name
        field.argument(*argument_args, **argument_kwargs)
      end
    end
  end
  if !(extras = self.class.extras).empty?
    @added_extras = extras - field.extras
    field.extras(@added_extras)
  else
    @added_extras = nil
  end
  freeze
end