Commit e7f900a2 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Drop numeric support for AlertPayloadField

parent b41c91a6
...@@ -31,7 +31,8 @@ module Gitlab ...@@ -31,7 +31,8 @@ module Gitlab
) )
end end
# TODO: Code duplication with Gitlab::InlineHash#merge_keys ahead! # Code duplication with Gitlab::InlineHash#merge_keys ahead!
# See https://gitlab.com/gitlab-org/gitlab/-/issues/299856
def deep_traverse(hash) def deep_traverse(hash)
return to_enum(__method__, hash) unless block_given? return to_enum(__method__, hash) unless block_given?
...@@ -54,8 +55,6 @@ module Gitlab ...@@ -54,8 +55,6 @@ module Gitlab
'datetime' 'datetime'
when String when String
'string' 'string'
when Numeric
'numeric'
when Array when Array
'array' 'array'
end end
......
...@@ -12,12 +12,10 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do ...@@ -12,12 +12,10 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do
subject(:fields) { extractor.extract(json) } subject(:fields) { extractor.extract(json) }
context 'plain' do describe '#extract' do
before do before do
payload.merge!( payload.merge!(
str: 'value', str: 'value',
int: 23,
float: 23.5,
nested: { nested: {
key: 'level1', key: 'level1',
deep: { deep: {
...@@ -32,11 +30,9 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do ...@@ -32,11 +30,9 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do
) )
end end
it 'works' do it 'returns all the possible field combination and types suggestions' do
expect(fields).to contain_exactly( expect(fields).to contain_exactly(
a_field(['str'], 'Str', 'string'), a_field(['str'], 'Str', 'string'),
a_field(['int'], 'Int', 'numeric'),
a_field(['float'], 'Float', 'numeric'),
a_field(%w(nested key), 'Key', 'string'), a_field(%w(nested key), 'Key', 'string'),
a_field(%w(nested deep key), 'Key', 'string'), a_field(%w(nested deep key), 'Key', 'string'),
a_field(['time'], 'Time', 'datetime'), a_field(['time'], 'Time', 'datetime'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment