8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/graphql/mutations/concerns/mutations/work_items/widgetable.rb', line 8
def (work_item_type, attributes, resource_parent)
widget_keys = ::WorkItems::WidgetDefinition.available_widgets.map(&:api_symbol)
widget_params = attributes.(*widget_keys)
not_supported_keys = widget_params.keys - work_item_type.widget_classes(resource_parent).map(&:api_symbol)
if not_supported_keys.present?
raise Gitlab::Graphql::Errors::ArgumentError,
"Following widget keys are not supported by #{work_item_type.name} type: #{not_supported_keys}"
end
widget_params.transform_values do |input|
input.is_a?(Array) ? input.map(&:to_h) : input.to_h
end
end
|