File tree Expand file tree Collapse file tree
lib/graphql/schema/member Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,12 +18,38 @@ def validates(validation_config)
1818
1919 # @return [Array<GraphQL::Schema::Validator>]
2020 def validators
21- own_validators = @own_validators || EMPTY_ARRAY
22- if self . is_a? ( Class ) && superclass . respond_to? ( :validators ) && ( inherited_validators = superclass . validators ) . any?
23- inherited_validators + own_validators
24- else
25- own_validators
21+ @own_validators || EMPTY_ARRAY
22+ end
23+
24+ module ClassConfigured
25+ def inherited ( child_cls )
26+ super
27+ child_cls . extend ( ClassValidators )
2628 end
29+
30+ module ClassValidators
31+ include Schema ::FindInheritedValue ::EmptyObjects
32+
33+ def validators
34+ inherited_validators = superclass . validators
35+ if inherited_validators . any?
36+ if @own_validators . nil?
37+ inherited_validators
38+ else
39+ inherited_validators + @own_validators
40+ end
41+ elsif @own_validators . nil?
42+ EMPTY_ARRAY
43+ else
44+ @own_validators
45+ end
46+ end
47+ end
48+ end
49+
50+ def self . extended ( child_cls )
51+ super
52+ child_cls . extend ( ClassConfigured )
2753 end
2854 end
2955 end
You can’t perform that action at this time.
0 commit comments