Sha256: 420c30dc3e2d50c818e54d3f7376dbb72c3508ee9e2238adbef9a3f386b31d1d
Contents?: true
Size: 578 Bytes
Versions: 4
Compression:
Stored size: 578 Bytes
Contents
class GraphQL::StaticValidation::DirectivesAreDefined include GraphQL::StaticValidation::Message::MessageHelper def validate(context) directive_names = context.schema.directives.keys context.visitor[GraphQL::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
Version data entries
4 entries across 4 versions & 1 rubygems