We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8ffd788 + 41ab9b4 commit 28677d1Copy full SHA for 28677d1
1 file changed
lib/graphql/static_validation/validator.rb
@@ -32,10 +32,13 @@ def validate(query, validate: true)
32
33
context = GraphQL::StaticValidation::ValidationContext.new(query, visitor_class)
34
35
- # Attach legacy-style rules
36
- rules_to_use.each do |rule_class_or_module|
37
- if rule_class_or_module.method_defined?(:validate)
38
- rule_class_or_module.new.validate(context)
+ # Attach legacy-style rules.
+ # Only loop through rules if it has legacy-style rules
+ unless (legacy_rules = rules_to_use - GraphQL::StaticValidation::ALL_RULES).empty?
+ legacy_rules.each do |rule_class_or_module|
39
+ if rule_class_or_module.method_defined?(:validate)
40
+ rule_class_or_module.new.validate(context)
41
+ end
42
end
43
44
0 commit comments