Sha256: d9448ea119b139a627024c2e3c69be1a9d33d8c5ef342e541cafd4948f95ef6f
Contents?: true
Size: 759 Bytes
Versions: 10
Compression:
Stored size: 759 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) } 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
10 entries across 10 versions & 1 rubygems