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/schema/relay_classic_mutation.rb | lib/graphql/schema/relay_classic_mutation.rb | # frozen_string_literal: true
module GraphQL
class Schema
# Mutations that extend this base class get some conventions added for free:
#
# - An argument called `clientMutationId` is _always_ added, but it's not passed
# to the resolve method. The value is re-inserted to the response. (It's for
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/has_single_input_argument.rb | lib/graphql/schema/has_single_input_argument.rb | # frozen_string_literal: true
module GraphQL
class Schema
module HasSingleInputArgument
def resolve_with_support(**inputs)
if inputs[:input].is_a?(InputObject)
input = inputs[:input].to_kwargs
else
input = inputs[:input]
end
new_extras = field ? field.ex... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/wrapper.rb | lib/graphql/schema/wrapper.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Wrapper
include GraphQL::Schema::Member::TypeSystemHelpers
# @return [Class, Module] The inner type of this wrapping type, the type of which one or more objects may be present.
attr_reader :of_type
def initialize(of_type)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/late_bound_type.rb | lib/graphql/schema/late_bound_type.rb | # frozen_string_literal: true
module GraphQL
class Schema
# A stand-in for a type which will be resolved in a given schema, by name.
# TODO: support argument types too, make this a public API somehow
# @api Private
class LateBoundType
attr_reader :name
alias :graphql_name :name
def i... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/input_object.rb | lib/graphql/schema/input_object.rb | # frozen_string_literal: true
module GraphQL
class Schema
class InputObject < GraphQL::Schema::Member
extend Forwardable
extend GraphQL::Schema::Member::HasArguments
extend GraphQL::Schema::Member::HasArguments::ArgumentObjectLoader
extend GraphQL::Schema::Member::ValidatesInput
exte... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/argument.rb | lib/graphql/schema/argument.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Argument
include GraphQL::Schema::Member::HasPath
include GraphQL::Schema::Member::HasAstNode
include GraphQL::Schema::Member::HasDirectives
include GraphQL::Schema::Member::HasDeprecationReason
include GraphQL::Schema::... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/scalar.rb | lib/graphql/schema/scalar.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Scalar < GraphQL::Schema::Member
extend GraphQL::Schema::Member::ValidatesInput
class << self
def coerce_input(val, ctx)
val
end
def coerce_result(val, ctx)
val
end
def kind
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/type_expression.rb | lib/graphql/schema/type_expression.rb | # frozen_string_literal: true
module GraphQL
class Schema
# @api private
module TypeExpression
# Fetch a type from a type map by its AST specification.
# Return `nil` if not found.
# @param type_owner [#type] A thing for looking up types by name
# @param ast_node [GraphQL::Language::No... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/base_64_encoder.rb | lib/graphql/schema/base_64_encoder.rb | # frozen_string_literal: true
require "base64"
module GraphQL
class Schema
# @api private
module Base64Encoder
def self.encode(unencoded_text, nonce: false)
Base64.urlsafe_encode64(unencoded_text, padding: false)
end
def self.decode(encoded_text, nonce: false)
# urlsafe_deco... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/always_visible.rb | lib/graphql/schema/always_visible.rb | # frozen_string_literal: true
module GraphQL
class Schema
module AlwaysVisible
def self.use(schema, **opts)
schema.use(GraphQL::Schema::Visibility, profiles: { nil => {} })
schema.extend(self)
end
def visible?(_member, _context)
true
end
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/schema/build_from_definition/resolve_map.rb | lib/graphql/schema/build_from_definition/resolve_map.rb | # frozen_string_literal: true
require "graphql/schema/build_from_definition/resolve_map/default_resolve"
module GraphQL
class Schema
module BuildFromDefinition
# Wrap a user-provided hash of resolution behavior for easy access at runtime.
#
# Coerce scalar values by:
# - Checking for a fu... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb | lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb | # frozen_string_literal: true
module GraphQL
class Schema
module BuildFromDefinition
class ResolveMap
class DefaultResolve
def initialize(field_map, field_name)
@field_map = field_map
@field_name = field_name
end
# Make some runtime checks about... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_deprecation_reason.rb | lib/graphql/schema/member/has_deprecation_reason.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasDeprecationReason
# @return [String, nil] Explains why this member was deprecated (if present, this will be marked deprecated in introspection)
attr_reader :deprecation_reason
# Set the deprecation rea... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/relay_shortcuts.rb | lib/graphql/schema/member/relay_shortcuts.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module RelayShortcuts
def edge_type_class(new_edge_type_class = nil)
if new_edge_type_class
initialize_relay_metadata
@edge_type_class = new_edge_type_class
else
# Don't ca... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_interfaces.rb | lib/graphql/schema/member/has_interfaces.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasInterfaces
def implements(*new_interfaces, **options)
new_memberships = []
new_interfaces.each do |int|
if int.is_a?(Module)
unless int.include?(GraphQL::Schema::Interface)... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_validators.rb | lib/graphql/schema/member/has_validators.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasValidators
include GraphQL::EmptyObjects
# Build {GraphQL::Schema::Validator}s based on the given configuration
# and use them for this schema member
# @param validation_config [Hash{Symbol => H... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/scoped.rb | lib/graphql/schema/member/scoped.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module Scoped
# This is called when a field has `scope: true`.
# The field's return type class receives this call.
#
# By default, it's a no-op. Override it to scope your objects.
#
# @par... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_path.rb | lib/graphql/schema/member/has_path.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasPath
# @return [String] A description of this member's place in the GraphQL schema
def path
path_str = if self.respond_to?(:graphql_name)
self.graphql_name
elsif self.class.respo... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_ast_node.rb | lib/graphql/schema/member/has_ast_node.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasAstNode
def self.extended(child_cls)
super
child_cls.ast_node = nil
end
def inherited(child_cls)
super
child_cls.ast_node = nil
end
# If this sch... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_unresolved_type_error.rb | lib/graphql/schema/member/has_unresolved_type_error.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
# Set up a type-specific error to make debugging & bug tracker integration better
module HasUnresolvedTypeError
private
def add_unresolved_type_error(child_class)
if child_class.name # Don't set this for ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_fields.rb | lib/graphql/schema/member/has_fields.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
# Shared code for Objects, Interfaces, Mutations, Subscriptions
module HasFields
# Add a field to this object or interface with the given definition
# @see {GraphQL::Schema::Field#initialize} for method signature
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/build_type.rb | lib/graphql/schema/member/build_type.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
# @api private
module BuildType
LIST_TYPE_ERROR = "Use an array of [T] or [T, null: true] for list types; other arrays are not supported"
module_function
# @param type_expr [String, Class, GraphQL::BaseType... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_dataloader.rb | lib/graphql/schema/member/has_dataloader.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
# @api public
# Shared methods for working with {Dataloader} inside GraphQL runtime objects.
module HasDataloader
# @return [GraphQL::Dataloader] The dataloader for the currently-running query
def dataloader
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/base_dsl_methods.rb | lib/graphql/schema/member/base_dsl_methods.rb | # frozen_string_literal: true
require "graphql/schema/find_inherited_value"
module GraphQL
class Schema
class Member
# DSL methods shared by lots of things in the GraphQL Schema.
# @api private
# @see Classes that extend this, eg {GraphQL::Schema::Object}
module BaseDSLMethods
in... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_arguments.rb | lib/graphql/schema/member/has_arguments.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasArguments
def self.included(cls)
cls.extend(ArgumentClassAccessor)
cls.include(ArgumentObjectLoader)
end
def self.extended(cls)
cls.extend(ArgumentClassAccessor)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/has_directives.rb | lib/graphql/schema/member/has_directives.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module HasDirectives
def self.extended(child_cls)
super
child_cls.module_exec { self.own_directives = nil }
end
def inherited(child_cls)
super
child_cls.own_directives = n... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/validates_input.rb | lib/graphql/schema/member/validates_input.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module ValidatesInput
def valid_input?(val, ctx)
validate_input(val, ctx).valid?
end
def validate_input(val, ctx, max_errors: nil)
if val.nil?
Query::InputValidationResult::VALID
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/graphql_type_names.rb | lib/graphql/schema/member/graphql_type_names.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
# These constants are interpreted as GraphQL types when defining fields or arguments
#
# @example
# field :is_draft, Boolean, null: false
# field :id, ID, null: false
# field :score, Int, null: false
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/member/type_system_helpers.rb | lib/graphql/schema/member/type_system_helpers.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Member
module TypeSystemHelpers
def initialize(...)
super
@to_non_null_type ||= nil
@to_list_type ||= nil
end
# @return [Schema::NonNull] Make a non-null-type representation of this type
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/resolver/has_payload_type.rb | lib/graphql/schema/resolver/has_payload_type.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Resolver
# Adds `field(...)` helper to resolvers so that they can
# generate payload types.
#
# Or, an already-defined one can be attached with `payload_type(...)`.
module HasPayloadType
# Call this method to ge... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/visibility/visit.rb | lib/graphql/schema/visibility/visit.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Visibility
class Visit
def initialize(schema, &visit_block)
@schema = schema
@late_bound_types = nil
@unvisited_types = nil
# These accumulate between calls to prevent re-visiting the same types
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/visibility/profile.rb | lib/graphql/schema/visibility/profile.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Visibility
# This class filters the types, fields, arguments, enum values, and directives in a schema
# based on the given `context`.
#
# It's like {Warden}, but has some differences:
#
# - It doesn't use {Schema}... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/visibility/migration.rb | lib/graphql/schema/visibility/migration.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Visibility
# You can use this to see how {GraphQL::Schema::Warden} and {GraphQL::Schema::Visibility::Profile}
# handle `.visible?` differently in your schema.
#
# It runs the same method on both implementations and raises an e... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/field/scope_extension.rb | lib/graphql/schema/field/scope_extension.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Field
class ScopeExtension < GraphQL::Schema::FieldExtension
def after_resolve(object:, arguments:, context:, value:, memo:)
if value.nil?
value
else
ret_type = @field.type.unwrap
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/field/connection_extension.rb | lib/graphql/schema/field/connection_extension.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Field
class ConnectionExtension < GraphQL::Schema::FieldExtension
def apply
field.argument :after, "String", "Returns the elements in the list that come after the specified cursor.", required: false
field.argument :... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/format_validator.rb | lib/graphql/schema/validator/format_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to assert that string values match (or don't match) the given RegExp.
#
# @example requiring input to match a pattern
#
# argument :handle, String, required: true,
# validates: { format:... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/required_validator.rb | lib/graphql/schema/validator/required_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this validator to require _one_ of the named arguments to be present.
# Or, use Arrays of symbols to name a valid _set_ of arguments.
#
# (This is for specifying mutually exclusive sets of arguments.)
#
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/numericality_validator.rb | lib/graphql/schema/validator/numericality_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to assert numerical comparisons hold true for inputs.
#
# @example Require a number between 0 and 1
#
# argument :batting_average, Float, required: true, validates: { numericality: { within: 0..1 }... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/allow_blank_validator.rb | lib/graphql/schema/validator/allow_blank_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to specifically reject values that respond to `.blank?` and respond truthy for that method.
#
# @example Require a non-empty string for an argument
# argument :name, String, required: true, validate: { ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/allow_null_validator.rb | lib/graphql/schema/validator/allow_null_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to specifically reject or permit `nil` values (given as `null` from GraphQL).
#
# @example require a non-null value for an argument if it is provided
# argument :name, String, required: false, validates... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/inclusion_validator.rb | lib/graphql/schema/validator/inclusion_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# You can use this to allow certain values for an argument.
#
# Usually, a {GraphQL::Schema::Enum} is better for this, because it's self-documenting.
#
# @example only allow certain values for an argument
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/length_validator.rb | lib/graphql/schema/validator/length_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to enforce a `.length` restriction on incoming values. It works for both Strings and Lists.
#
# @example Allow no more than 10 IDs
#
# argument :ids, [ID], required: true, validates: { length: { m... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/all_validator.rb | lib/graphql/schema/validator/all_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to validate each member of an array value.
#
# @example validate format of all strings in an array
#
# argument :handles, [String],
# validates: { all: { format: { with: /\A[a-z0-9_]+\Z/... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/validator/exclusion_validator.rb | lib/graphql/schema/validator/exclusion_validator.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Validator
# Use this to specifically reject values from an argument.
#
# @example disallow certain values
#
# argument :favorite_non_prime, Integer, required: true,
# validates: { exclusion: { in: [2, 3, 5, ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/deprecated.rb | lib/graphql/schema/directive/deprecated.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
class Deprecated < GraphQL::Schema::Directive
description "Marks an element of a GraphQL schema as no longer supported."
locations(GraphQL::Schema::Directive::FIELD_DEFINITION, GraphQL::Schema... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/include.rb | lib/graphql/schema/directive/include.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
class Include < GraphQL::Schema::Directive
description "Directs the executor to include this field or fragment only when the `if` argument is true."
locations(
GraphQL::Schema::Dire... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/specified_by.rb | lib/graphql/schema/directive/specified_by.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
class SpecifiedBy < GraphQL::Schema::Directive
description "Exposes a URL that specifies the behavior of this scalar."
locations(GraphQL::Schema::Directive::SCALAR)
default_directive t... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/flagged.rb | lib/graphql/schema/directive/flagged.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
# This is _similar_ to {Directive::Feature}, except it's prescribed by the server, not the client.
#
# In this case, the server hides types and fields _entirely_, unless the current context has ce... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/transform.rb | lib/graphql/schema/directive/transform.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
# An example directive to show how you might interact with the runtime.
#
# This directive takes the return value of the tagged part of the query,
# and if the named transform is whitelisted... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/feature.rb | lib/graphql/schema/directive/feature.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
# An example directive to show how you might interact with the runtime.
#
# This directive might be used along with a server-side feature flag system like Flipper.
#
# With that system... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/skip.rb | lib/graphql/schema/directive/skip.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
class Skip < Schema::Directive
description "Directs the executor to skip this field or fragment when the `if` argument is true."
locations(
GraphQL::Schema::Directive::FIELD,
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/schema/directive/one_of.rb | lib/graphql/schema/directive/one_of.rb | # frozen_string_literal: true
module GraphQL
class Schema
class Directive < GraphQL::Schema::Member
class OneOf < GraphQL::Schema::Directive
description "Requires that exactly one field must be supplied and that field must not be `null`."
locations(GraphQL::Schema::Directive::INPUT_OBJECT)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/source.rb | lib/graphql/dataloader/source.rb | # frozen_string_literal: true
module GraphQL
class Dataloader
class Source
# Called by {Dataloader} to prepare the {Source}'s internal state
# @api private
def setup(dataloader)
# These keys have been requested but haven't been fetched yet
@pending = {}
# These keys have... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/active_record_association_source.rb | lib/graphql/dataloader/active_record_association_source.rb | # frozen_string_literal: true
require "graphql/dataloader/source"
require "graphql/dataloader/active_record_source"
module GraphQL
class Dataloader
class ActiveRecordAssociationSource < GraphQL::Dataloader::Source
RECORD_SOURCE_CLASS = ActiveRecordSource
def initialize(association, scope = nil)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/null_dataloader.rb | lib/graphql/dataloader/null_dataloader.rb | # frozen_string_literal: true
module GraphQL
class Dataloader
# GraphQL-Ruby uses this when Dataloader isn't enabled.
#
# It runs execution code inline and gathers lazy objects (eg. Promises)
# and resolves them during {#run}.
class NullDataloader < Dataloader
def initialize(*)
@laz... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/async_dataloader.rb | lib/graphql/dataloader/async_dataloader.rb | # frozen_string_literal: true
module GraphQL
class Dataloader
class AsyncDataloader < Dataloader
def yield(source = Fiber[:__graphql_current_dataloader_source])
trace = Fiber[:__graphql_current_multiplex]&.current_trace
trace&.dataloader_fiber_yield(source)
if (condition = Fiber[:gra... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/request.rb | lib/graphql/dataloader/request.rb | # frozen_string_literal: true
module GraphQL
class Dataloader
# @see Source#request which returns an instance of this
class Request
def initialize(source, key)
@source = source
@key = key
end
# Call this method to cause the current Fiber to wait for the results of this reque... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/active_record_source.rb | lib/graphql/dataloader/active_record_source.rb | # frozen_string_literal: true
require "graphql/dataloader/source"
module GraphQL
class Dataloader
class ActiveRecordSource < GraphQL::Dataloader::Source
def initialize(model_class, find_by: model_class.primary_key)
@model_class = model_class
@find_by = find_by
@find_by_many = find_b... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/graphql/dataloader/request_all.rb | lib/graphql/dataloader/request_all.rb | # frozen_string_literal: true
module GraphQL
class Dataloader
# @see Source#request_all which returns an instance of this.
class RequestAll < Request
def initialize(source, keys)
@source = source
@keys = keys
end
# Call this method to cause the current Fiber to wait for the ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/object_generator.rb | lib/generators/graphql/object_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
require 'generators/graphql/field_extractor'
module Graphql
module Generators
# Generate an object type by name,
# with the specified fields.
#
# ```
# rails g graphql:object PostType name:String!
# ```
#
# Add ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/core.rb | lib/generators/graphql/core.rb | # frozen_string_literal: true
require 'rails/generators/base'
module Graphql
module Generators
module Core
def self.included(base)
base.send(
:class_option,
:directory,
type: :string,
default: "app/graphql",
desc: "Directory where generated files sh... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/orm_mutations_base.rb | lib/generators/graphql/orm_mutations_base.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/named_base'
require_relative 'core'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutatio... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/type_generator.rb | lib/generators/graphql/type_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require 'graphql'
require 'active_support'
require 'active_support/core_ext/string/inflections'
require_relative 'core'
module Graphql
module Generators
class TypeGeneratorBase < Rails::Generators::NamedBase
include Co... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/field_extractor.rb | lib/generators/graphql/field_extractor.rb | # frozen_string_literal: true
require 'rails/generators/base'
module Graphql
module Generators
module FieldExtractor
def fields
columns = []
columns += (klass&.columns&.map { |c| generate_column_string(c) } || [])
columns + custom_fields
end
def generate_column_string(... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/relay_generator.rb | lib/generators/graphql/relay_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
module Graphql
module Generators
class RelayGenerator < Rails::Generators::Base
include Core
include Relay
desc "Add base types and fields for Relay-style n... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/mutation_create_generator.rb | lib/generators/graphql/mutation_create_generator.rb | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation CreatePostMutation
class MutationCreateGenera... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/union_generator.rb | lib/generators/graphql/union_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate a union type by name
# with the specified member types.
#
# ```
# rails g graphql:union SearchResultType ImageType AudioType
# ```
class UnionGenerator < TypeGeneratorBase... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/relay.rb | lib/generators/graphql/relay.rb | # frozen_string_literal: true
module Graphql
module Generators
module Relay
def install_relay
# Add Node, `node(id:)`, and `nodes(ids:)`
template("node_type.erb", "#{options[:directory]}/types/node_type.rb")
in_root do
fields = <<-RUBY
field :node, Types::NodeType, null... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/enum_generator.rb | lib/generators/graphql/enum_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate an enum type by name, with the given values.
# To add a `value:` option, add another value after a `:`.
#
# ```
# rails g graphql:enum ProgrammingLanguage RUBY PYTHON PERL PERL6:"... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/mutation_update_generator.rb | lib/generators/graphql/mutation_update_generator.rb | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation UpdatePostMutation
class MutationUpdateGenera... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/mutation_generator.rb | lib/generators/graphql/mutation_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/named_base'
require_relative 'core'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutatio... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/scalar_generator.rb | lib/generators/graphql/scalar_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate a scalar type by given name.
#
# ```
# rails g graphql:scalar Date
# ```
class ScalarGenerator < TypeGeneratorBase
desc "Create a GraphQL::ScalarType with the given name... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/interface_generator.rb | lib/generators/graphql/interface_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate an interface type by name,
# with the specified fields.
#
# ```
# rails g graphql:interface NamedEntityType name:String!
# ```
class InterfaceGenerator < TypeGeneratorBase... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/mutation_delete_generator.rb | lib/generators/graphql/mutation_delete_generator.rb | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation DeletePostMutation
class MutationDeleteGenera... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/input_generator.rb | lib/generators/graphql/input_generator.rb | # frozen_string_literal: true
require 'generators/graphql/type_generator'
require 'generators/graphql/field_extractor'
module Graphql
module Generators
# Generate an input type by name,
# with the specified fields.
#
# ```
# rails g graphql:object PostType name:string!
# ```
class InputGe... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/install_generator.rb | lib/generators/graphql/install_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
module Graphql
module Generators
# Add GraphQL to a Rails app with `rails g graphql:install`.
#
# Setup a folder structure for GraphQL:
#
# ```
# - app/
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/loader_generator.rb | lib/generators/graphql/loader_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require "rails/generators/named_base"
require_relative "core"
module Graphql
module Generators
# @example Generate a `GraphQL::Batch` loader by name.
# rails g graphql:loader RecordLoader
class LoaderGenerator < Rails::Generators::NamedBase
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/lib/generators/graphql/install/mutation_root_generator.rb | lib/generators/graphql/install/mutation_root_generator.rb | # frozen_string_literal: true
require "rails/generators/base"
require_relative "../core"
module Graphql
module Generators
module Install
class MutationRootGenerator < Rails::Generators::Base
include Core
desc "Create mutation base type, mutation root type, and adds the latter to the schem... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/guides/_tasks/site.rb | guides/_tasks/site.rb | # frozen_string_literal: true
require "yard"
require "webrick"
namespace :apidocs do
desc "Fetch a gem version from RubyGems, build the docs"
task :gen_version, [:version] do |t, args|
# GITHUB_REF comes from GitHub Actions
version = args[:version] || ENV["GITHUB_REF"] || raise("A version is required")
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/guides/_plugins/api_doc.rb | guides/_plugins/api_doc.rb | # frozen_string_literal: true
require_relative "../../lib/graphql/version"
require "kramdown"
module GraphQLSite
API_DOC_ROOT = "/api-doc/#{GraphQL::VERSION}/"
module APIDoc
def api_doc(input)
if !input.start_with?("GraphQL")
ruby_ident = "GraphQL::#{input}"
else
ruby_ident = input... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/tasks/performance/optimization_status.rb | tasks/performance/optimization_status.rb | # backtick_javascript: true
klasses = [
Array,
Class,
# Complex,
# Dir,
Enumerable,
Enumerator,
Exception,
Hash,
# Kernel,
Math,
Method,
Module,
Object,
Proc,
Range,
Rational,
Regexp,
Struct,
String,
Time
]
%x{
function getOptimizationStatus(fn) {
var optstatus = %GetOpti... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/tasks/testing/mspec_special_calls.rb | tasks/testing/mspec_special_calls.rb | require 'opal/nodes/call'
require 'opal/ast/builder'
class Opal::Nodes::CallNode
# Rubyspec uses these calls features at runtime.
# We can't do this at runtime, so handle it during compilation
add_special :not_supported_on do |compile_default|
unless arglist.children.include?(s(:sym, :opal))
compile_d... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/opal.rb | opal/opal.rb | ::Object.require 'opal/base'
::Object.require 'opal/mini'
::Object.require 'corelib/kernel/format'
::Object.require 'corelib/string/encoding'
::Object.autoload :Math, 'corelib/math'
::Object.require 'corelib/complex/base'
::Object.autoload :Complex, 'corelib/complex'
::Object.require 'corelib/rational/base'
::Object.a... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/proc.rb | opal/corelib/proc.rb | # helpers: slice, each_ivar
# backtick_javascript: true
# use_strict: true
class ::Proc < `Function`
`Opal.prop(self.$$prototype, '$$is_proc', true)`
`Opal.prop(self.$$prototype, '$$is_lambda', false)`
def self.new(&block)
unless block
::Kernel.raise ::ArgumentError, 'tried to create a Proc object wit... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/main.rb | opal/corelib/main.rb | # backtick_javascript: true
class << self
def to_s
'main'
end
def include(mod)
::Object.include mod
end
def autoload(*args)
`Opal.Object.$autoload.apply(Opal.Object, args)`
end
# Compiler overrides this method
def using(mod)
::Kernel.raise 'main.using is permitted only at toplevel'
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/io.rb | opal/corelib/io.rb | # backtick_javascript: true
class ::IO
self::SEEK_SET = 0
self::SEEK_CUR = 1
self::SEEK_END = 2
self::SEEK_DATA = 3
self::SEEK_HOLE = 4
self::READABLE = 1
self::WRITABLE = 4
attr_reader :eof
attr_accessor :read_proc, :sync, :tty, :write_proc
def initialize(fd, flags = 'r')
@fd = fd
@fl... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/range.rb | opal/corelib/range.rb | # backtick_javascript: true
# use_strict: true
require 'corelib/enumerable'
class ::Range
include ::Enumerable
`self.$$prototype.$$is_range = true`
attr_reader :begin, :end
def initialize(first, last, exclude = false)
::Kernel.raise ::NameError, "'initialize' called twice" if @begin
::Kernel.raise ... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/object_space.rb | opal/corelib/object_space.rb | # backtick_javascript: true
# helpers: respond_to, truthy
module ::ObjectSpace
module_function
%x{
var callers = {}, registry, add_caller, delete_callers;
if (typeof FinalizationRegistry === "function") {
registry = new FinalizationRegistry(function(id) {
if (typeof callers[id] !== "undefine... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/struct.rb | opal/corelib/struct.rb | # backtick_javascript: true
require 'corelib/enumerable'
class ::Struct
include ::Enumerable
def self.new(const_name, *args, keyword_init: false, &block)
if const_name
if const_name.class == ::String && const_name[0].upcase != const_name[0]
# Fast track so that we skip needlessly going thru exc... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/comparable.rb | opal/corelib/comparable.rb | # helpers: truthy
# backtick_javascript: true
module ::Comparable
%x{
function normalize(what) {
if (Opal.is_a(what, Opal.Integer)) { return what; }
if (#{`what` > 0}) { return 1; }
if (#{`what` < 0}) { return -1; }
return 0;
}
function fail_comparison(lhs, rhs) {
var clas... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/method.rb | opal/corelib/method.rb | # backtick_javascript: true
class ::Method
attr_reader :owner, :receiver, :name
def initialize(receiver, owner, method, name)
@receiver = receiver
@owner = owner
@name = name
@method = method
end
def arity
@method.arity
end
def parameters
`#{@method}.$$parameters`
end
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/variables.rb | opal/corelib/variables.rb | # backtick_javascript: true
# use_strict: true
# regexp matches
%x{$gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil}
# requires
$LOADED_FEATURES = $" = `Opal.loaded_features`
$LOAD_PATH = $: = []
# split lines
$/ = "\n"
$, = nil
::ARGV = []
::ARGF = ::Object.new
::ENV = {}
$VERBOSE = false
$DEBUG... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/math.rb | opal/corelib/math.rb | # helpers: type_error
# backtick_javascript: true
# use_strict: true
module ::Math
self::E = `Math.E`
self::PI = `Math.PI`
self::DomainError = ::Class.new(::StandardError)
def self.checked(method, *args)
%x{
if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) {
return NaN;
}
... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/array.rb | opal/corelib/array.rb | # helpers: truthy, falsy, yield1, hash_get, hash_put, hash_delete, coerce_to, respond_to, deny_frozen_access, freeze, opal32_init, opal32_add
# backtick_javascript: true
require 'corelib/enumerable'
require 'corelib/numeric'
class ::Array < `Array`
include ::Enumerable
# Mark all javascript arrays as being valid... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | true |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/set.rb | opal/corelib/set.rb | # helpers: freeze
# backtick_javascript: true
# use_strict: true
# Portions Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
class ::Set
include ::Enumerable
def self.[](*ary)
new(ary)
end
def initialize(enum = nil, &block)
@hash = {}
return if enum.nil?
::Kernel.raise ::ArgumentErro... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/time.rb | opal/corelib/time.rb | # helpers: slice, deny_frozen_access
# backtick_javascript: true
# use_strict: true
require 'corelib/comparable'
class ::Time < `Date`
include ::Comparable
%x{
var days_of_week = #{%w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday]},
short_days = #{%w[Sun Mon Tue Wed Thu Fri Sat]},... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/file.rb | opal/corelib/file.rb | # helpers: truthy
# backtick_javascript: true
class ::File < ::IO
Separator = SEPARATOR = '/'
ALT_SEPARATOR = nil
PATH_SEPARATOR = ':'
# Assuming case insenstive filesystem
FNM_SYSCASE = 0
windows_root_rx = %r{^[a-zA-Z]:(?:\\|\/)}
class << self
def absolute_path(path, basedir = nil)
sep = SEPA... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/boolean.rb | opal/corelib/boolean.rb | # use_strict: true
# backtick_javascript: true
class ::Boolean < `Boolean`
`Opal.prop(self.$$prototype, '$$is_boolean', true)`
%x{
var properties = ['$$class', '$$meta'];
for (var i = 0; i < properties.length; i++) {
Object.defineProperty(self.$$prototype, properties[i], {
configurable: tru... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/constants.rb | opal/corelib/constants.rb | ::RUBY_PLATFORM = 'opal'
::RUBY_ENGINE = 'opal'
::RUBY_VERSION = '3.2.0'
::RUBY_ENGINE_VERSION = '2.0.0dev'
::RUBY_RELEASE_DATE = '2023-11-16'
::RUBY_PATCHLEVEL = 0
::RUBY_REVISION = '0'
::RUBY_COPYRIGHT = 'opal - Copyright (C) 2011-2023 Adam Beynon and the Opal contributors'
::RUB... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/opal/corelib/irb.rb | opal/corelib/irb.rb | # backtick_javascript: true
# Debug is a helper module that allows us to conduct some debugging on
# a live codebase. It goes with an assumption, that opal-parser or
# opal-replutils will not be loaded, in which case we will do what we can
# to provision it.
require 'runtime/irb'
module Opal
module IRB
def sel... | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.