Sha256: c89fa3c092fbd524bb3aa0f3e94c96ed7f23ad91505674263816f5bd3b77fe14
Contents?: true
Size: 789 Bytes
Versions: 75
Compression:
Stored size: 789 Bytes
Contents
# frozen_string_literal: true module GraphQL module StaticValidation class DirectivesAreDefined include GraphQL::StaticValidation::Message::MessageHelper def validate(context) directive_names = context.schema.directives.keys context.visitor[GraphQL::Language::Nodes::Directive] << ->(node, parent) { validate_directive(node, directive_names, context) } end private def validate_directive(ast_directive, directive_names, context) if !directive_names.include?(ast_directive.name) context.errors << message("Directive @#{ast_directive.name} is not defined", ast_directive, context: context) GraphQL::Language::Visitor::SKIP else nil end end end end end
Version data entries
75 entries across 75 versions & 1 rubygems