Sha256: cfd60e7b2d8fe0598bf1e3b7d7495b79e2f5ab9cc54ac205330ce89ec25122a6
Contents?: true
Size: 885 Bytes
Versions: 13
Compression:
Stored size: 885 Bytes
Contents
module GraphQL module StaticValidation # Generates GraphQL-compliant validation message. # Only supports one "location", too bad :( class Message # Convenience for validators module MessageHelper # Error `message` is located at `node` def message(message, node) GraphQL::StaticValidation::Message.new(message, line: node.line, col: node.col) end end attr_reader :message, :line, :col def initialize(message, line: nil, col: nil) @message = message @line = line @col = col end # A hash representation of this Message def to_h { "message" => message, "locations" => locations } end private def locations @line.nil? && @col.nil? ? [] : [{"line" => @line, "column" => @col}] end end end end
Version data entries
13 entries across 13 versions & 1 rubygems