Module: GraphQL

Defined in:
lib/graphql/parse_error.rb,
lib/graphql.rb,
lib/graphql/dig.rb,
lib/graphql/field.rb,
lib/graphql/query.rb,
lib/graphql/define.rb,
lib/graphql/filter.rb,
lib/graphql/schema.rb,
lib/graphql/railtie.rb,
lib/graphql/tracing.rb,
lib/graphql/version.rb,
lib/graphql/argument.rb,
lib/graphql/function.rb,
lib/graphql/language.rb,
lib/graphql/types/id.rb,
lib/graphql/backtrace.rb,
lib/graphql/base_type.rb,
lib/graphql/directive.rb,
lib/graphql/enum_type.rb,
lib/graphql/list_type.rb,
lib/graphql/rake_task.rb,
lib/graphql/types/int.rb,
lib/graphql/relay/edge.rb,
lib/graphql/relay/node.rb,
lib/graphql/type_kinds.rb,
lib/graphql/types/json.rb,
lib/graphql/union_type.rb,
lib/graphql/object_type.rb,
lib/graphql/scalar_type.rb,
lib/graphql/schema/enum.rb,
lib/graphql/schema/list.rb,
lib/graphql/types/float.rb,
lib/graphql/types/relay.rb,
lib/graphql/analysis/ast.rb,
lib/graphql/query/result.rb,
lib/graphql/schema/field.rb,
lib/graphql/schema/union.rb,
lib/graphql/types/string.rb,
lib/graphql/authorization.rb,
lib/graphql/field/resolve.rb,
lib/graphql/introspection.rb,
lib/graphql/non_null_type.rb,
lib/graphql/query/context.rb,
lib/graphql/schema/finder.rb,
lib/graphql/schema/loader.rb,
lib/graphql/schema/member.rb,
lib/graphql/schema/object.rb,
lib/graphql/schema/scalar.rb,
lib/graphql/schema/warden.rb,
lib/graphql/subscriptions.rb,
lib/graphql/types/big_int.rb,
lib/graphql/types/boolean.rb,
lib/graphql/analysis_error.rb,
lib/graphql/coercion_error.rb,
lib/graphql/deprecated_dsl.rb,
lib/graphql/execution/lazy.rb,
lib/graphql/interface_type.rb,
lib/graphql/language/lexer.rb,
lib/graphql/language/nodes.rb,
lib/graphql/language/token.rb,
lib/graphql/name_validator.rb,
lib/graphql/query/executor.rb,
lib/graphql/relay/mutation.rb,
lib/graphql/schema/printer.rb,
lib/graphql/schema/timeout.rb,
lib/graphql/schema/wrapper.rb,
lib/graphql/backtrace/table.rb,
lib/graphql/execution_error.rb,
lib/graphql/language/parser.rb,
lib/graphql/query/arguments.rb,
lib/graphql/query/variables.rb,
lib/graphql/relay/edge_type.rb,
lib/graphql/relay/page_info.rb,
lib/graphql/relay/range_add.rb,
lib/graphql/schema/argument.rb,
lib/graphql/schema/mutation.rb,
lib/graphql/schema/non_null.rb,
lib/graphql/schema/resolver.rb,
lib/graphql/upgrader/member.rb,
lib/graphql/upgrader/schema.rb,
lib/graphql/backtrace/tracer.rb,
lib/graphql/execution/errors.rb,
lib/graphql/language/printer.rb,
lib/graphql/language/visitor.rb,
lib/graphql/schema/directive.rb,
lib/graphql/schema/interface.rb,
lib/graphql/schema/null_mask.rb,
lib/graphql/schema/traversal.rb,
lib/graphql/types/relay/node.rb,
lib/graphql/execution/execute.rb,
lib/graphql/execution/flatten.rb,
lib/graphql/input_object_type.rb,
lib/graphql/schema/enum_value.rb,
lib/graphql/schema/validation.rb,
lib/graphql/execution/typecast.rb,
lib/graphql/invalid_name_error.rb,
lib/graphql/invalid_null_error.rb,
lib/graphql/query/null_context.rb,
lib/graphql/rake_task/validate.rb,
lib/graphql/runtime_type_error.rb,
lib/graphql/unauthorized_error.rb,
lib/graphql/define/type_definer.rb,
lib/graphql/execution/lookahead.rb,
lib/graphql/execution/multiplex.rb,
lib/graphql/language/generation.rb,
lib/graphql/query/literal_input.rb,
lib/graphql/schema/input_object.rb,
lib/graphql/schema/subscription.rb,
lib/graphql/subscriptions/event.rb,
lib/graphql/analysis/ast/visitor.rb,
lib/graphql/analysis/field_usage.rb,
lib/graphql/analysis/query_depth.rb,
lib/graphql/schema/member/scoped.rb,
lib/graphql/analysis/ast/analyzer.rb,
lib/graphql/execution/interpreter.rb,
lib/graphql/language/block_string.rb,
lib/graphql/query/arguments_cache.rb,
lib/graphql/relay/base_connection.rb,
lib/graphql/relay/connection_type.rb,
lib/graphql/relay/mutation/result.rb,
lib/graphql/relay/type_extensions.rb,
lib/graphql/schema/built_in_types.rb,
lib/graphql/schema/directive/skip.rb,
lib/graphql/schema/possible_types.rb,
lib/graphql/string_encoding_error.rb,
lib/graphql/tracing/scout_tracing.rb,
lib/graphql/types/relay/base_edge.rb,
lib/graphql/types/relay/page_info.rb,
lib/graphql/unresolved_type_error.rb,
lib/graphql/analysis/analyze_query.rb,
lib/graphql/analysis/reducer_state.rb,
lib/graphql/backtrace/traced_error.rb,
lib/graphql/define/assign_argument.rb,
lib/graphql/execution/lazy/resolve.rb,
lib/graphql/integer_encoding_error.rb,
lib/graphql/query/serial_execution.rb,
lib/graphql/relay/array_connection.rb,
lib/graphql/relay/mutation/resolve.rb,
lib/graphql/schema/base_64_encoder.rb,
lib/graphql/schema/field_extension.rb,
lib/graphql/schema/late_bound_type.rb,
lib/graphql/schema/member/has_path.rb,
lib/graphql/schema/type_expression.rb,
lib/graphql/types/relay/base_field.rb,
lib/graphql/types/relay/node_field.rb,
lib/graphql/backwards_compatibility.rb,
lib/graphql/introspection/type_type.rb,
lib/graphql/relay/global_id_resolve.rb,
lib/graphql/schema/middleware_chain.rb,
lib/graphql/static_validation/error.rb,
lib/graphql/subscriptions/serialize.rb,
lib/graphql/types/relay/base_object.rb,
lib/graphql/types/relay/nodes_field.rb,
lib/graphql/analysis/ast/field_usage.rb,
lib/graphql/analysis/ast/query_depth.rb,
lib/graphql/analysis/max_query_depth.rb,
lib/graphql/backtrace/inspect_result.rb,
lib/graphql/define/assign_connection.rb,
lib/graphql/define/assign_enum_value.rb,
lib/graphql/introspection/field_type.rb,
lib/graphql/literal_validation_error.rb,
lib/graphql/relay/connection_resolve.rb,
lib/graphql/schema/directive/feature.rb,
lib/graphql/schema/directive/include.rb,
lib/graphql/schema/member/build_type.rb,
lib/graphql/schema/member/has_fields.rb,
lib/graphql/schema/rescue_middleware.rb,
lib/graphql/tracing/data_dog_tracing.rb,
lib/graphql/tracing/platform_tracing.rb,
lib/graphql/tracing/skylight_tracing.rb,
lib/graphql/types/iso_8601_date_time.rb,
lib/graphql/unauthorized_field_error.rb,
lib/graphql/analysis/query_complexity.rb,
lib/graphql/define/instance_definable.rb,
lib/graphql/define/non_null_with_bang.rb,
lib/graphql/execution/instrumentation.rb,
lib/graphql/introspection/base_object.rb,
lib/graphql/introspection/schema_type.rb,
lib/graphql/language/definition_slice.rb,
lib/graphql/query/validation_pipeline.rb,
lib/graphql/relay/relation_connection.rb,
lib/graphql/schema/default_type_error.rb,
lib/graphql/schema/invalid_type_error.rb,
lib/graphql/schema/timeout_middleware.rb,
lib/graphql/schema/unique_within_type.rb,
lib/graphql/tracing/appsignal_tracing.rb,
lib/graphql/tracing/new_relic_tracing.rb,
lib/graphql/define/assign_object_field.rb,
lib/graphql/define/no_definition_error.rb,
lib/graphql/execution/directive_checks.rb,
lib/graphql/introspection/entry_points.rb,
lib/graphql/schema/catchall_middleware.rb,
lib/graphql/schema/default_parse_error.rb,
lib/graphql/schema/directive/transform.rb,
lib/graphql/tracing/prometheus_tracing.rb,
lib/graphql/types/relay/base_interface.rb,
lib/graphql/define/defined_object_proxy.rb,
lib/graphql/relay/edges_instrumentation.rb,
lib/graphql/schema/find_inherited_value.rb,
lib/graphql/schema/introspection_system.rb,
lib/graphql/schema/member/has_arguments.rb,
lib/graphql/static_validation/all_rules.rb,
lib/graphql/static_validation/validator.rb,
lib/graphql/types/relay/base_connection.rb,
lib/graphql/analysis/ast/max_query_depth.rb,
lib/graphql/internal_representation/node.rb,
lib/graphql/introspection/directive_type.rb,
lib/graphql/introspection/dynamic_fields.rb,
lib/graphql/introspection/type_kind_enum.rb,
lib/graphql/schema/build_from_definition.rb,
lib/graphql/schema/field/scope_extension.rb,
lib/graphql/static_validation/type_stack.rb,
lib/graphql/analysis/ast/query_complexity.rb,
lib/graphql/analysis/max_query_complexity.rb,
lib/graphql/define/assign_global_id_field.rb,
lib/graphql/execution/interpreter/resolve.rb,
lib/graphql/execution/interpreter/runtime.rb,
lib/graphql/internal_representation/print.rb,
lib/graphql/internal_representation/scope.rb,
lib/graphql/internal_representation/visit.rb,
lib/graphql/introspection/enum_value_type.rb,
lib/graphql/query/input_validation_result.rb,
lib/graphql/schema/member/instrumentation.rb,
lib/graphql/schema/member/relay_shortcuts.rb,
lib/graphql/schema/relay_classic_mutation.rb,
lib/graphql/subscriptions/instrumentation.rb,
lib/graphql/execution/lazy/lazy_method_map.rb,
lib/graphql/introspection/input_value_type.rb,
lib/graphql/relay/mutation/instrumentation.rb,
lib/graphql/schema/member/base_dsl_methods.rb,
lib/graphql/static_validation/base_visitor.rb,
lib/graphql/define/assign_mutation_function.rb,
lib/graphql/internal_representation/rewrite.rb,
lib/graphql/query/variable_validation_error.rb,
lib/graphql/relay/mongo_relation_connection.rb,
lib/graphql/subscriptions/subscription_root.rb,
lib/graphql/internal_representation/document.rb,
lib/graphql/relay/connection_instrumentation.rb,
lib/graphql/schema/member/accepts_definition.rb,
lib/graphql/schema/member/graphql_type_names.rb,
lib/graphql/schema/resolver/has_payload_type.rb,
lib/graphql/analysis/ast/max_query_complexity.rb,
lib/graphql/schema/field/connection_extension.rb,
lib/graphql/schema/member/type_system_helpers.rb,
lib/graphql/static_validation/default_visitor.rb,
lib/graphql/execution/interpreter/hash_response.rb,
lib/graphql/static_validation/literal_validator.rb,
lib/graphql/load_application_object_failed_error.rb,
lib/graphql/static_validation/validation_context.rb,
lib/graphql/compatibility/execution_specification.rb,
lib/graphql/introspection/directive_location_enum.rb,
lib/graphql/static_validation/interpreter_visitor.rb,
lib/graphql/static_validation/no_validate_visitor.rb,
lib/graphql/execution/interpreter/execution_errors.rb,
lib/graphql/query/serial_execution/field_resolution.rb,
lib/graphql/query/serial_execution/value_resolution.rb,
lib/graphql/schema/member/cached_graphql_definition.rb,
lib/graphql/compatibility/query_parser_specification.rb,
lib/graphql/language/document_from_schema_definition.rb,
lib/graphql/schema/build_from_definition/resolve_map.rb,
lib/graphql/subscriptions/action_cable_subscriptions.rb,
lib/graphql/compatibility/schema_parser_specification.rb,
lib/graphql/static_validation/definition_dependencies.rb,
lib/graphql/static_validation/rules/fields_will_merge.rb,
lib/graphql/compatibility/lazy_execution_specification.rb,
lib/graphql/static_validation/rules/fragments_are_used.rb,
lib/graphql/query/serial_execution/operation_resolution.rb,
lib/graphql/query/serial_execution/selection_resolution.rb,
lib/graphql/static_validation/rules/fragments_are_named.rb,
lib/graphql/static_validation/rules/fragment_types_exist.rb,
lib/graphql/static_validation/rules/fragments_are_finite.rb,
lib/graphql/static_validation/rules/mutation_root_exists.rb,
lib/graphql/tracing/active_support_notifications_tracing.rb,
lib/graphql/tracing/prometheus_tracing/graphql_collector.rb,
lib/graphql/static_validation/rules/arguments_are_defined.rb,
lib/graphql/static_validation/rules/directives_are_defined.rb,
lib/graphql/static_validation/rules/fields_will_merge_error.rb,
lib/graphql/static_validation/rules/fragments_are_used_error.rb,
lib/graphql/static_validation/rules/subscription_root_exists.rb,
lib/graphql/static_validation/rules/argument_names_are_unique.rb,
lib/graphql/static_validation/rules/fragment_names_are_unique.rb,
lib/graphql/static_validation/rules/fragments_are_named_error.rb,
lib/graphql/static_validation/rules/operation_names_are_valid.rb,
lib/graphql/static_validation/rules/variable_names_are_unique.rb,
lib/graphql/static_validation/rules/variables_are_input_types.rb,
lib/graphql/static_validation/rules/fields_are_defined_on_type.rb,
lib/graphql/static_validation/rules/fragment_types_exist_error.rb,
lib/graphql/static_validation/rules/fragments_are_finite_error.rb,
lib/graphql/static_validation/rules/mutation_root_exists_error.rb,
lib/graphql/static_validation/rules/no_definitions_are_present.rb,
lib/graphql/static_validation/rules/arguments_are_defined_error.rb,
lib/graphql/static_validation/rules/variable_usages_are_allowed.rb,
lib/graphql/compatibility/execution_specification/counter_schema.rb,
lib/graphql/static_validation/rules/directives_are_defined_error.rb,
lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb,
lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb,
lib/graphql/static_validation/rules/required_arguments_are_present.rb,
lib/graphql/static_validation/rules/subscription_root_exists_error.rb,
lib/graphql/static_validation/rules/unique_directives_per_location.rb,
lib/graphql/static_validation/rules/variables_are_used_and_defined.rb,
lib/graphql/static_validation/rules/argument_names_are_unique_error.rb,
lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb,
lib/graphql/static_validation/rules/operation_names_are_valid_error.rb,
lib/graphql/static_validation/rules/variable_names_are_unique_error.rb,
lib/graphql/static_validation/rules/variables_are_input_types_error.rb,
lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb,
lib/graphql/static_validation/rules/argument_literals_are_compatible.rb,
lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb,
lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb,
lib/graphql/static_validation/rules/no_definitions_are_present_error.rb,
lib/graphql/compatibility/query_parser_specification/query_assertions.rb,
lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb,
lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb,
lib/graphql/compatibility/execution_specification/specification_schema.rb,
lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb,
lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb,
lib/graphql/static_validation/rules/required_arguments_are_present_error.rb,
lib/graphql/static_validation/rules/unique_directives_per_location_error.rb,
lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb,
lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb,
lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb,
lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb,
lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb,
lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb,
lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb,
lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb,
lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb,
lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb

Overview

test_via: ../subscriptions.rb

Defined Under Namespace

Modules: Analysis, Authorization, BackwardsCompatibility, Compatibility, Define, DeprecatedDSL, Dig, Execution, InternalRepresentation, Introspection, Language, Relay, StaticValidation, StringDedupBackport, Tracing, TypeKinds, Types, Upgrader Classes: AnalysisError, Argument, Backtrace, BaseType, CoercionError, Directive, DoubleNonNullTypeError, EnumType, Error, ExecutionError, Field, Filter, Function, InputObjectType, IntegerEncodingError, InterfaceType, InvalidNameError, InvalidNullError, ListType, LiteralValidationError, LoadApplicationObjectFailedError, NameValidator, NonNullType, ObjectType, ParseError, Query, Railtie, RakeTask, RuntimeTypeError, ScalarType, Schema, StringEncodingError, Subscriptions, UnauthorizedError, UnauthorizedFieldError, UnionType, UnresolvedTypeError

Constant Summary collapse

ID_TYPE =
GraphQL::Types::ID.graphql_definition
VERSION =
"1.9.12"
INT_TYPE =
GraphQL::Types::Int.graphql_definition
FLOAT_TYPE =
GraphQL::Types::Float.graphql_definition
STRING_TYPE =
GraphQL::Types::String.graphql_definition
BOOLEAN_TYPE =
GraphQL::Types::Boolean.graphql_definition

Class Method Summary collapse

Class Method Details

.parse(graphql_string, tracer: GraphQL::Tracing::NullTracer) ⇒ GraphQL::Language::Nodes::Document

Turn a query string or schema definition into an AST

Parameters:

  • graphql_string (String)

    a GraphQL query string or schema definition

Returns:



16
17
18
# File 'lib/graphql.rb', line 16

def self.parse(graphql_string, tracer: GraphQL::Tracing::NullTracer)
  parse_with_racc(graphql_string, tracer: tracer)
end

.parse_file(filename) ⇒ GraphQL::Language::Nodes::Document

Read the contents of filename and parse them as GraphQL

Parameters:

  • filename (String)

    Path to a .graphql file containing IDL or query

Returns:



23
24
25
26
# File 'lib/graphql.rb', line 23

def self.parse_file(filename)
  content = File.read(filename)
  parse_with_racc(content, filename: filename)
end

.parse_with_racc(string, filename: nil, tracer: GraphQL::Tracing::NullTracer) ⇒ Object



28
29
30
# File 'lib/graphql.rb', line 28

def self.parse_with_racc(string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
  GraphQL::Language::Parser.parse(string, filename: filename, tracer: tracer)
end

.scan(graphql_string) ⇒ Array<GraphQL::Language::Token>

Returns:



33
34
35
# File 'lib/graphql.rb', line 33

def self.scan(graphql_string)
  scan_with_ragel(graphql_string)
end

.scan_with_ragel(graphql_string) ⇒ Object



37
38
39
# File 'lib/graphql.rb', line 37

def self.scan_with_ragel(graphql_string)
  GraphQL::Language::Lexer.tokenize(graphql_string)
end