Commit 36cc60a4 authored by allison.browne's avatar allison.browne

Revert "Make parent_validations work"

This reverts commit efab9bd02d6a962641bbdb7d53c63091e1299356.
parent 7eb70c63
...@@ -11,6 +11,8 @@ module Gitlab ...@@ -11,6 +11,8 @@ module Gitlab
include ::Gitlab::Config::Entry::Validatable include ::Gitlab::Config::Entry::Validatable
validations do validations do
validates :config, type: Hash
validate do validate do
each_unmatched_job do |name| each_unmatched_job do |name|
errors.add(name, 'config should implement a script: or a trigger: keyword') errors.add(name, 'config should implement a script: or a trigger: keyword')
......
...@@ -10,14 +10,12 @@ module Gitlab ...@@ -10,14 +10,12 @@ module Gitlab
class ComposableHash < ::Gitlab::Config::Entry::Node class ComposableHash < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Validatable include ::Gitlab::Config::Entry::Validatable
def self.parent_validations # TODO: Refactor Validatable so these validations will not apply to a child class
validations do # See: https://gitlab.com/gitlab-org/gitlab/-/issues/263231
validates :config, type: Hash validations do
end validates :config, type: Hash
end end
parent_validations
def compose!(deps = nil) def compose!(deps = nil)
super do super do
@config.each do |name, config| @config.each do |name, config|
......
...@@ -20,8 +20,6 @@ module Gitlab ...@@ -20,8 +20,6 @@ module Gitlab
yield(self) if block_given? yield(self) if block_given?
self.class.parent_validations if self.class.respond_to?(:parent_validations)
self.class.aspects.to_a.each do |aspect| self.class.aspects.to_a.each do |aspect|
instance_exec(&aspect) instance_exec(&aspect)
end end
......
...@@ -39,6 +39,8 @@ module Gitlab ...@@ -39,6 +39,8 @@ module Gitlab
end end
end end
private
def validations(&block) def validations(&block)
(@validations ||= []).append(block) (@validations ||= []).append(block)
end end
......
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