repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/prometheus_trace.rb | lib/graphql/tracing/prometheus_trace.rb | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby times to Prometheus.
#
# The PrometheusExporter server must be run with a custom type collector that extends `GraphQL::Tracing::PrometheusTracing::GraphQLCollector`.
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/statsd_tracing.rb | lib/graphql/tracing/statsd_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class StatsdTracing < PlatformTracing
self.platform_keys = {
'lex' => "graphql.lex",
'parse' => "graphql.parse",
'validate' => "graphql.validate",
'analyze_query' => "grap... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/statsd_trace.rb | lib/graphql/tracing/statsd_trace.rb | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby times to Statsd.
# Passing any Statsd client that implements `.time(name) { ... }`
# and `.timing(name, ms)` will work.
#
# @example Installing this tracer
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/monitor_trace.rb | lib/graphql/tracing/monitor_trace.rb | # frozen_string_literal: true
module GraphQL
module Tracing
# This module is the basis for Ruby-level integration with third-party monitoring platforms.
# Platform-specific traces include this module and implement an adapter.
#
# @see ActiveSupportNotificationsTrace Integration via ActiveSupport::Not... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/scout_tracing.rb | lib/graphql/tracing/scout_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class ScoutTracing < PlatformTracing
INSTRUMENT_OPTS = { scope: true }
self.platform_keys = {
"lex" => "lex.graphql",
"parse" => "parse.graphql",
"validate" => "validate.gr... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/appsignal_tracing.rb | lib/graphql/tracing/appsignal_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class AppsignalTracing < PlatformTracing
self.platform_keys = {
"lex" => "lex.graphql",
"parse" => "parse.graphql",
"validate" => "validate.graphql",
"analyze_query" => "a... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/data_dog_tracing.rb | lib/graphql/tracing/data_dog_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class DataDogTracing < PlatformTracing
self.platform_keys = {
'lex' => 'lex.graphql',
'parse' => 'parse.graphql',
'validate' => 'validate.graphql',
'analyze_query' => 'ana... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/new_relic_trace.rb | lib/graphql/tracing/new_relic_trace.rb | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby time to New Relic
#
# @example Installing the tracer
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::NewRelicTrace
#
# # O... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/detailed_trace.rb | lib/graphql/tracing/detailed_trace.rb | # frozen_string_literal: true
require "graphql/tracing/detailed_trace/memory_backend"
require "graphql/tracing/detailed_trace/redis_backend"
module GraphQL
module Tracing
# `DetailedTrace` can make detailed profiles for a subset of production traffic.
#
# When `MySchema.detailed_trace?(query)` returns `t... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/call_legacy_tracers.rb | lib/graphql/tracing/call_legacy_tracers.rb | # frozen_string_literal: true
module GraphQL
module Tracing
# This trace class calls legacy-style tracer with payload hashes.
# New-style `trace_with` modules significantly reduce the overhead of tracing,
# but that advantage is lost when legacy-style tracers are also used (since the payload hashes are s... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/prometheus_tracing.rb | lib/graphql/tracing/prometheus_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class PrometheusTracing < PlatformTracing
DEFAULT_WHITELIST = ['execute_field', 'execute_field_lazy'].freeze
DEFAULT_COLLECTOR_TYPE = 'graphql'.freeze
self.platform_keys = {
'lex' =>... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/appoptics_trace.rb | lib/graphql/tracing/appoptics_trace.rb | # frozen_string_literal: true
require "graphql/tracing/platform_trace"
module GraphQL
module Tracing
# This class uses the AppopticsAPM SDK from the appoptics_apm gem to create
# traces for GraphQL.
#
# There are 4 configurations available. They can be set in the
# appoptics_apm config file or ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/notifications_trace.rb | lib/graphql/tracing/notifications_trace.rb | # frozen_string_literal: true
module GraphQL
module Tracing
# This implementation forwards events to a notification handler
# (i.e. ActiveSupport::Notifications or Dry::Monitor::Notifications) with a `graphql` suffix.
#
# @see ActiveSupportNotificationsTrace ActiveSupport::Notifications integration
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/data_dog_trace.rb | lib/graphql/tracing/data_dog_trace.rb | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting to DataDog
# @example Adding this tracer to your schema
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::DataDogTrace
# end
# @example Skipping... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/appsignal_trace.rb | lib/graphql/tracing/appsignal_trace.rb | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# Instrumentation for reporting GraphQL-Ruby times to Appsignal.
#
# @example Installing the tracer
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::AppsignalTrace
# en... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/platform_tracing.rb | lib/graphql/tracing/platform_tracing.rb | # frozen_string_literal: true
module GraphQL
module Tracing
# Each platform provides:
# - `.platform_keys`
# - `#platform_trace`
# - `#platform_field_key(type, field)`
# @api private
class PlatformTracing
class << self
attr_accessor :platform_keys
def inherited(child_cl... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/legacy_hooks_trace.rb | lib/graphql/tracing/legacy_hooks_trace.rb | # frozen_string_literal: true
module GraphQL
module Tracing
module LegacyHooksTrace
def execute_multiplex(multiplex:)
multiplex_instrumenters = multiplex.schema.instrumenters[:multiplex]
query_instrumenters = multiplex.schema.instrumenters[:query]
# First, run multiplex instrumentat... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/platform_trace.rb | lib/graphql/tracing/platform_trace.rb | # frozen_string_literal: true
module GraphQL
module Tracing
module PlatformTrace
def initialize(trace_scalars: false, **_options)
@trace_scalars = trace_scalars
@platform_key_cache = Hash.new { |h, mod| h[mod] = mod::KeyCache.new }
super
end
module BaseKeyCache
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/new_relic_tracing.rb | lib/graphql/tracing/new_relic_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class NewRelicTracing < PlatformTracing
self.platform_keys = {
"lex" => "GraphQL/lex",
"parse" => "GraphQL/parse",
"validate" => "GraphQL/validate",
"analyze_query" => "Gr... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/trace.rb | lib/graphql/tracing/trace.rb | # frozen_string_literal: true
require "graphql/tracing"
module GraphQL
module Tracing
# This is the base class for a `trace` instance whose methods are called during query execution.
# "Trace modes" are subclasses of this with custom tracing modules mixed in.
#
# A trace module may implement any of ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/appoptics_tracing.rb | lib/graphql/tracing/appoptics_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
# This class uses the AppopticsAPM SDK from the appoptics_apm gem to create
# traces for GraphQL.
#
# There are 4 configurations available. They can be set in the
# appoptics_apm config file o... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/perfetto_trace.rb | lib/graphql/tracing/perfetto_trace.rb | # frozen_string_literal: true
module GraphQL
module Tracing
# This produces a trace file for inspecting in the [Perfetto Trace Viewer](https://ui.perfetto.dev).
#
# To get the file, call {#write} on the trace.
#
# Use "trace modes" to configure this to run on command or on a sample of traffic.
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/null_trace.rb | lib/graphql/tracing/null_trace.rb | # frozen_string_literal: true
require "graphql/tracing/trace"
module GraphQL
module Tracing
NullTrace = Trace.new.freeze
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/notifications_tracing.rb | lib/graphql/tracing/notifications_tracing.rb | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
# This implementation forwards events to a notification handler (i.e.
# ActiveSupport::Notifications or Dry::Monitor::Notifications)
# with a `graphql` suffix.
#
# @see KEYS for event names
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/prometheus_trace/graphql_collector.rb | lib/graphql/tracing/prometheus_trace/graphql_collector.rb | # frozen_string_literal: true
require "graphql/tracing"
module GraphQL
module Tracing
module PrometheusTrace
class GraphQLCollector < ::PrometheusExporter::Server::TypeCollector
def initialize
@graphql_gauge = PrometheusExporter::Metric::Base.default_aggregation.new(
'graphql... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/detailed_trace/redis_backend.rb | lib/graphql/tracing/detailed_trace/redis_backend.rb | # frozen_string_literal: true
module GraphQL
module Tracing
class DetailedTrace
class RedisBackend
KEY_PREFIX = "gql:trace:"
def initialize(redis:, limit: nil)
@redis = redis
@key = KEY_PREFIX + "traces"
@remrangebyrank_limit = limit ? -limit - 1 : nil
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/detailed_trace/memory_backend.rb | lib/graphql/tracing/detailed_trace/memory_backend.rb | # frozen_string_literal: true
module GraphQL
module Tracing
class DetailedTrace
# An in-memory trace storage backend. Suitable for testing and development only.
# It won't work for multi-process deployments and everything is erased when the app is restarted.
class MemoryBackend
def init... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/tracing/perfetto_trace/trace_pb.rb | lib/graphql/tracing/perfetto_trace/trace_pb.rb | # frozen_string_literal: true
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: trace.proto
require 'google/protobuf'
descriptor_data = "\n\x0btrace.proto\x12\x15perfetto_trace.protos\";\n\x05Trace\x12\x32\n\x06packet\x18\x01 \x03(\x0b\x32\".perfetto_trace.protos.TracePacket\"\x8a\x03\n\x0bTracePa... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/base_visitor.rb | lib/graphql/static_validation/base_visitor.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class BaseVisitor < GraphQL::Language::StaticVisitor
def initialize(document, context)
@path = []
@object_types = []
@directives = []
@field_definitions = []
@argument_definitions = []
@direc... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/literal_validator.rb | lib/graphql/static_validation/literal_validator.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# Test whether `ast_value` is a valid input for `type`
class LiteralValidator
def initialize(context:)
@context = context
@types = context.types
@invalid_response = GraphQL::Query::InputValidationResult.new(vali... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/validation_context.rb | lib/graphql/static_validation/validation_context.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# The validation context gets passed to each validator.
#
# It exposes a {GraphQL::Language::Visitor} where validators may add hooks. ({Language::Visitor#visit} is called in {Validator#validate})
#
# It provides access to the sch... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/definition_dependencies.rb | lib/graphql/static_validation/definition_dependencies.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# Track fragment dependencies for operations
# and expose the fragment definitions which
# are used by a given operation
module DefinitionDependencies
attr_reader :dependencies
def initialize(*)
super
@de... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/validator.rb | lib/graphql/static_validation/validator.rb | # frozen_string_literal: true
require "timeout"
module GraphQL
module StaticValidation
# Initialized with a {GraphQL::Schema}, then it can validate {GraphQL::Language::Nodes::Documents}s based on that schema.
#
# By default, it's used by {GraphQL::Query}
#
# @example Validate a query
# vali... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/interpreter_visitor.rb | lib/graphql/static_validation/interpreter_visitor.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class InterpreterVisitor < BaseVisitor
include(GraphQL::StaticValidation::DefinitionDependencies)
StaticValidation::ALL_RULES.reverse_each do |r|
include(r)
end
include(ContextMethods)
end
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/validation_timeout_error.rb | lib/graphql/static_validation/validation_timeout_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ValidationTimeoutError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extension... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/all_rules.rb | lib/graphql/static_validation/all_rules.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# Default rules for {GraphQL::StaticValidation::Validator}
#
# Order is important here. Some validators skip later hooks.
# which stops the visit on that node. That way it doesn't try to find fields on types that
# don't exist, e... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/error.rb | lib/graphql/static_validation/error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# Generates GraphQL-compliant validation message.
class Error
# Convenience for validators
module ErrorHelper
# Error `error_message` is located at `node`
def error(error_message, nodes, context: nil, path: nil, e... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_names_are_unique.rb | lib/graphql/static_validation/rules/variable_names_are_unique.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module VariableNamesAreUnique
def on_operation_definition(node, parent)
var_defns = node.variables
if !var_defns.empty?
vars_by_name = Hash.new { |h, k| h[k] = [] }
var_defns.each { |v| vars_by_name[v.na... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb | lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class VariablesAreUsedAndDefinedError < StaticValidation::Error
attr_reader :variable_name
attr_reader :violation
VIOLATIONS = {
:VARIABLE_NOT_USED => "variableNotUsed",
:VARIABLE_NOT_DEFINED => "variableN... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb | lib/graphql/static_validation/rules/argument_literals_are_compatible.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module ArgumentLiteralsAreCompatible
def on_argument(node, parent)
# Check the child arguments first;
# don't add a new error if one of them reports an error
super
# Don't validate variables here
if... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/arguments_are_defined_error.rb | lib/graphql/static_validation/rules/arguments_are_defined_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ArgumentsAreDefinedError < StaticValidation::Error
attr_reader :name
attr_reader :type_name
attr_reader :argument_name
attr_reader :parent
def initialize(message, path: nil, nodes: [], name:, type:, argument_... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb | lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentSpreadsArePossible
def initialize(*)
super
@spreads_to_validate = []
end
def on_inline_fragment(node, parent)
fragment_parent = context.object_types[-2]
fragment_child = context.o... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb | lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# Scalars _can't_ have selections
# Objects _must_ have selections
module FieldsHaveAppropriateSelections
include GraphQL::StaticValidation::Error::ErrorHelper
def on_field(node, parent)
field_defn = field_definition... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb | lib/graphql/static_validation/rules/operation_names_are_valid_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class OperationNamesAreValidError < StaticValidation::Error
attr_reader :operation_name
def initialize(message, path: nil, nodes: [], name: nil)
super(message, path: path, nodes: nodes)
@operation_name = name
e... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb | lib/graphql/static_validation/rules/argument_names_are_unique_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ArgumentNamesAreUniqueError < StaticValidation::Error
attr_reader :name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@name = name
end
# A hash repre... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb | lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FieldsAreDefinedOnTypeError < StaticValidation::Error
attr_reader :type_name
attr_reader :field_name
def initialize(message, path: nil, nodes: [], type:, field:)
super(message, path: path, nodes: nodes)
@... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb | lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module OneOfInputObjectsAreValid
def on_input_object(node, parent)
return super unless parent.is_a?(GraphQL::Language::Nodes::Argument)
parent_type = get_parent_type(context, parent)
return super unless parent_type... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb | lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class VariableDefaultValuesAreCorrectlyTypedError < StaticValidation::Error
attr_reader :variable_name
attr_reader :type_name
attr_reader :violation
VIOLATIONS = {
:INVALID_TYPE => "defaultValueInvalidTyp... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/required_arguments_are_present.rb | lib/graphql/static_validation/rules/required_arguments_are_present.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module RequiredArgumentsArePresent
def on_field(node, _parent)
assert_required_args(node, field_definition)
super
end
def on_directive(node, _parent)
directive_defn = context.schema_directives[node.name... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_types_exist.rb | lib/graphql/static_validation/rules/fragment_types_exist.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentTypesExist
def on_fragment_definition(node, _parent)
if validate_type_exists(node)
super
end
end
def on_inline_fragment(node, _parent)
if validate_type_exists(node)
su... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb | lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module DirectivesAreInValidLocations
include GraphQL::Language
def on_directive(node, parent)
validate_location(node, parent, context.schema_directives)
super
end
private
LOCATION_MESSAGE_NAMES = ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb | lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentSpreadsArePossibleError < StaticValidation::Error
attr_reader :type_name
attr_reader :fragment_name
attr_reader :parent_name
def initialize(message, path: nil, nodes: [], type:, fragment_name:, parent:)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/argument_names_are_unique.rb | lib/graphql/static_validation/rules/argument_names_are_unique.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module ArgumentNamesAreUnique
include GraphQL::StaticValidation::Error::ErrorHelper
def on_field(node, parent)
validate_arguments(node)
super
end
def on_directive(node, parent)
validate_arguments... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb | lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentsAreOnCompositeTypes
def on_fragment_definition(node, parent)
validate_type_is_composite(node) && super
end
def on_inline_fragment(node, parent)
validate_type_is_composite(node) && super
en... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb | lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ArgumentLiteralsAreCompatibleError < StaticValidation::Error
attr_reader :type_name
attr_reader :argument_name
attr_reader :argument
attr_reader :value
def initialize(message, path: nil, nodes: [], type:, arg... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_finite.rb | lib/graphql/static_validation/rules/fragments_are_finite.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentsAreFinite
def on_document(_n, _p)
super
dependency_map = context.dependencies
dependency_map.cyclical_definitions.each do |defn|
if defn.node.is_a?(GraphQL::Language::Nodes::FragmentDefinit... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/arguments_are_defined.rb | lib/graphql/static_validation/rules/arguments_are_defined.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module ArgumentsAreDefined
def on_argument(node, parent)
parent_defn = parent_definition(parent)
if parent_defn && @types.argument(parent_defn, node.name)
super
elsif parent_defn
kind_of_node = ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_will_merge_error.rb | lib/graphql/static_validation/rules/fields_will_merge_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FieldsWillMergeError < StaticValidation::Error
attr_reader :field_name
attr_reader :kind
def initialize(kind:, field_name:)
super(nil)
@field_name = field_name
@kind = kind
@conflicts = [... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb | lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module VariableDefaultValuesAreCorrectlyTyped
def on_variable_definition(node, parent)
if !node.default_value.nil?
value = node.default_value
type = context.schema.type_from_ast(node.type, context: context)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb | lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class OneOfInputObjectsAreValidError < StaticValidation::Error
attr_reader :input_object_type
def initialize(message, path:, nodes:, input_object_type:)
super(message, path: path, nodes: nodes)
@input_object_type = i... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb | lib/graphql/static_validation/rules/variables_are_used_and_defined.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
# The problem is
# - Variable $usage must be determined at the OperationDefinition level
# - You can't tell how fragments use variables until you visit FragmentDefinitions (which may be at the end of the document)
#
# So, th... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb | lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class DirectivesAreInValidLocationsError < StaticValidation::Error
attr_reader :target_name
attr_reader :name
def initialize(message, path: nil, nodes: [], target:, name: nil)
super(message, path: path, nodes: nodes)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb | lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentNamesAreUniqueError < StaticValidation::Error
attr_reader :fragment_name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@fragment_name = name
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/unique_directives_per_location.rb | lib/graphql/static_validation/rules/unique_directives_per_location.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module UniqueDirectivesPerLocation
DIRECTIVE_NODE_HOOKS = [
:on_fragment_definition,
:on_fragment_spread,
:on_inline_fragment,
:on_operation_definition,
:on_scalar_type_definition,
:on_object... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_named_error.rb | lib/graphql/static_validation/rules/fragments_are_named_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentsAreNamedError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extensio... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb | lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module SubscriptionRootExistsAndSingleSubscriptionSelection
def on_operation_definition(node, parent)
if node.operation_type == "subscription"
if context.types.subscription_root.nil?
add_error(GraphQL::StaticV... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/directives_are_defined_error.rb | lib/graphql/static_validation/rules/directives_are_defined_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class DirectivesAreDefinedError < StaticValidation::Error
attr_reader :directive_name
def initialize(message, path: nil, nodes: [], directive:)
super(message, path: path, nodes: nodes)
@directive_name = directive
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/query_root_exists_error.rb | lib/graphql/static_validation/rules/query_root_exists_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class QueryRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extensions... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb | lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class InputObjectNamesAreUniqueError < StaticValidation::Error
attr_reader :name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@name = name
end
# A hash re... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb | lib/graphql/static_validation/rules/variable_usages_are_allowed.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module VariableUsagesAreAllowed
def initialize(*)
super
# holds { name => ast_node } pairs
@declared_variables = {}
end
def on_operation_definition(node, parent)
@declared_variables = node.varia... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variables_are_input_types.rb | lib/graphql/static_validation/rules/variables_are_input_types.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module VariablesAreInputTypes
def on_variable_definition(node, parent)
type_name = get_type_name(node.type)
type = context.query.types.type(type_name)
if type.nil?
@all_possible_input_type_names ||= begin... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_used.rb | lib/graphql/static_validation/rules/fragments_are_used.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentsAreUsed
def on_document(node, parent)
super
dependency_map = context.dependencies
dependency_map.unmet_dependencies.each do |op_defn, spreads|
spreads.each do |fragment_spread|
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb | lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module RequiredInputObjectAttributesArePresent
def on_input_object(node, parent)
if parent.is_a? GraphQL::Language::Nodes::Argument
validate_input_object(node, context, parent)
end
super
end
p... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_types_exist_error.rb | lib/graphql/static_validation/rules/fragment_types_exist_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentTypesExistError < StaticValidation::Error
attr_reader :type_name
def initialize(message, path: nil, nodes: [], type:)
super(message, path: path, nodes: nodes)
@type_name = type
end
# A hash... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/directives_are_defined.rb | lib/graphql/static_validation/rules/directives_are_defined.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module DirectivesAreDefined
def initialize(*)
super
end
def on_directive(node, parent)
if !@types.directive_exists?(node.name)
@directives_are_defined_errors_by_name ||= {}
error = @directiv... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/not_single_subscription_error.rb | lib/graphql/static_validation/rules/not_single_subscription_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class NotSingleSubscriptionError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
exten... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb | lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FieldsHaveAppropriateSelectionsError < StaticValidation::Error
attr_reader :type_name
attr_reader :node_name
def initialize(message, path: nil, nodes: [], node_name:, type: nil)
super(message, path: path, nodes: ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/operation_names_are_valid.rb | lib/graphql/static_validation/rules/operation_names_are_valid.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module OperationNamesAreValid
def initialize(*)
super
@operation_names = Hash.new { |h, k| h[k] = [] }
end
def on_operation_definition(node, parent)
@operation_names[node.name] << node
super
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/mutation_root_exists_error.rb | lib/graphql/static_validation/rules/mutation_root_exists_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class MutationRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extensi... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_finite_error.rb | lib/graphql/static_validation/rules/fragments_are_finite_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentsAreFiniteError < StaticValidation::Error
attr_reader :fragment_name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@fragment_name = name
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb | lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class RequiredInputObjectAttributesArePresentError < StaticValidation::Error
attr_reader :argument_type
attr_reader :argument_name
attr_reader :input_object_type
def initialize(message, path:, nodes:, argument_type:, arg... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb | lib/graphql/static_validation/rules/required_arguments_are_present_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class RequiredArgumentsArePresentError < StaticValidation::Error
attr_reader :class_name
attr_reader :name
attr_reader :arguments
def initialize(message, path: nil, nodes: [], class_name:, name:, arguments:)
supe... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_named.rb | lib/graphql/static_validation/rules/fragments_are_named.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentsAreNamed
def on_fragment_definition(node, _parent)
if node.name.nil?
add_error(GraphQL::StaticValidation::FragmentsAreNamedError.new(
"Fragment definition has no name",
nodes: node
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb | lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class VariableUsagesAreAllowedError < StaticValidation::Error
attr_reader :type_name
attr_reader :variable_name
attr_reader :argument_name
attr_reader :error_message
def initialize(message, path: nil, nodes: [], ty... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/no_definitions_are_present.rb | lib/graphql/static_validation/rules/no_definitions_are_present.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module NoDefinitionsArePresent
include GraphQL::StaticValidation::Error::ErrorHelper
def initialize(*)
super
@schema_definition_nodes = []
end
def on_invalid_node(node, parent)
@schema_definition... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb | lib/graphql/static_validation/rules/fields_are_defined_on_type.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FieldsAreDefinedOnType
def on_field(node, parent)
parent_type = @object_types[-2]
field = context.query.types.field(parent_type, node.name)
if field.nil?
if parent_type.kind.union?
add_... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb | lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentsAreOnCompositeTypesError < StaticValidation::Error
attr_reader :type_name
attr_reader :argument_name
def initialize(message, path: nil, nodes: [], type:)
super(message, path: path, nodes: nodes)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/query_root_exists.rb | lib/graphql/static_validation/rules/query_root_exists.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module QueryRootExists
def on_operation_definition(node, _parent)
if (node.operation_type == 'query' || node.operation_type.nil?) && context.query.types.query_root.nil?
add_error(GraphQL::StaticValidation::QueryRootExists... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fields_will_merge.rb | lib/graphql/static_validation/rules/fields_will_merge.rb | # frozen_string_literal: true
# frozen_string_literal: true
module GraphQL
module StaticValidation
module FieldsWillMerge
# Validates that a selection set is valid if all fields (including spreading any
# fragments) either correspond to distinct response names or can be merged
# without ambigu... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb | lib/graphql/static_validation/rules/variable_names_are_unique_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class VariableNamesAreUniqueError < StaticValidation::Error
attr_reader :variable_name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@variable_name = name
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/mutation_root_exists.rb | lib/graphql/static_validation/rules/mutation_root_exists.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module MutationRootExists
def on_operation_definition(node, _parent)
if node.operation_type == 'mutation' && context.query.types.mutation_root.nil?
add_error(GraphQL::StaticValidation::MutationRootExistsError.new(
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/input_object_names_are_unique.rb | lib/graphql/static_validation/rules/input_object_names_are_unique.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module InputObjectNamesAreUnique
def on_input_object(node, parent)
validate_input_fields(node)
super
end
private
def validate_input_fields(node)
input_field_defns = node.arguments
input_f... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb | lib/graphql/static_validation/rules/no_definitions_are_present_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class NoDefinitionsArePresentError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
ext... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/subscription_root_exists_error.rb | lib/graphql/static_validation/rules/subscription_root_exists_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class SubscriptionRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
ext... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragment_names_are_unique.rb | lib/graphql/static_validation/rules/fragment_names_are_unique.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentNamesAreUnique
def initialize(*)
super
@fragments_by_name = Hash.new { |h, k| h[k] = [] }
end
def on_fragment_definition(node, parent)
@fragments_by_name[node.name] << node
super... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb | lib/graphql/static_validation/rules/unique_directives_per_location_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class UniqueDirectivesPerLocationError < StaticValidation::Error
attr_reader :directive_name
def initialize(message, path: nil, nodes: [], directive:)
super(message, path: path, nodes: nodes)
@directive_name = direct... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/fragments_are_used_error.rb | lib/graphql/static_validation/rules/fragments_are_used_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentsAreUsedError < StaticValidation::Error
attr_reader :fragment_name
def initialize(message, path: nil, nodes: [], fragment:)
super(message, path: path, nodes: nodes)
@fragment_name = fragment
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/static_validation/rules/variables_are_input_types_error.rb | lib/graphql/static_validation/rules/variables_are_input_types_error.rb | # frozen_string_literal: true
module GraphQL
module StaticValidation
class VariablesAreInputTypesError < StaticValidation::Error
attr_reader :type_name
attr_reader :variable_name
def initialize(message, path: nil, nodes: [], type:, name:)
super(message, path: path, nodes: nodes)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/execution/errors.rb | lib/graphql/execution/errors.rb | # frozen_string_literal: true
module GraphQL
module Execution
class Errors
# Register this handler, updating the
# internal handler index to maintain least-to-most specific.
#
# @param error_class [Class<Exception>]
# @param error_handlers [Hash]
# @param error_handler [Proc]
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/execution/lookahead.rb | lib/graphql/execution/lookahead.rb | # frozen_string_literal: true
module GraphQL
module Execution
# Lookahead creates a uniform interface to inspect the forthcoming selections.
#
# It assumes that the AST it's working with is valid. (So, it's safe to use
# during execution, but if you're using it directly, be sure to validate first.)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.