Sha256: 19de6e56a88846b8f6b0a7b75c2e74970f1ef76772e0b10fbf7160ca761b9028
Contents?: true
Size: 670 Bytes
Versions: 13
Compression:
Stored size: 670 Bytes
Contents
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.errors) } end private def validate_directive(ast_directive, directive_names, errors) if !directive_names.include?(ast_directive.name) errors << message("Directive @#{ast_directive.name} is not defined", ast_directive) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems