Welcome to mirror list, hosted at ThFree Co, Russian Federation.

custom_formats.rb « validator « dashboard « metrics « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 485e80ad1b74dd0b7a684cfb34ee8adfb149e0ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module Metrics
    module Dashboard
      module Validator
        class CustomFormats
          def format_handlers
            # Key is custom JSON Schema format name. Value is a proc that takes data and schema and handles
            # validations.
            @format_handlers ||= {
              "add_to_metric_id_cache" => ->(data, schema) { metric_ids_cache << data }
            }
          end

          def metric_ids_cache
            @metric_ids_cache ||= []
          end
        end
      end
    end
  end
end