Class: GraphQL::StaticValidation::UniqueDirectivesPerLocation
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::UniqueDirectivesPerLocation
- Includes:
- Message::MessageHelper
- Defined in:
- lib/graphql/static_validation/rules/unique_directives_per_location.rb
Constant Summary
- NODES_WITH_DIRECTIVES =
GraphQL::Language::Nodes.constants .map{|c| GraphQL::Language::Nodes.const_get(c)} .select{|c| c.is_a?(Class) && c.instance_methods.include?(:directives)}
Instance Method Summary collapse
Methods included from Message::MessageHelper
Instance Method Details
#validate(context) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/graphql/static_validation/rules/unique_directives_per_location.rb', line 11 def validate(context) NODES_WITH_DIRECTIVES.each do |node_class| context.visitor[node_class] << ->(node, _) { validate_directives(node, context) unless node.directives.empty? } end end |