graphql 1.11.3 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/graphql/core.rb +8 -0
- data/lib/generators/graphql/install_generator.rb +5 -5
- data/lib/generators/graphql/object_generator.rb +2 -0
- data/lib/generators/graphql/relay_generator.rb +63 -0
- data/lib/generators/graphql/templates/base_argument.erb +2 -0
- data/lib/generators/graphql/templates/base_connection.erb +8 -0
- data/lib/generators/graphql/templates/base_edge.erb +8 -0
- data/lib/generators/graphql/templates/base_enum.erb +2 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +2 -0
- data/lib/generators/graphql/templates/base_interface.erb +2 -0
- data/lib/generators/graphql/templates/base_mutation.erb +2 -0
- data/lib/generators/graphql/templates/base_object.erb +2 -0
- data/lib/generators/graphql/templates/base_scalar.erb +2 -0
- data/lib/generators/graphql/templates/base_union.erb +2 -0
- data/lib/generators/graphql/templates/enum.erb +2 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
- data/lib/generators/graphql/templates/interface.erb +2 -0
- data/lib/generators/graphql/templates/loader.erb +2 -0
- data/lib/generators/graphql/templates/mutation.erb +2 -0
- data/lib/generators/graphql/templates/mutation_type.erb +2 -0
- data/lib/generators/graphql/templates/node_type.erb +9 -0
- data/lib/generators/graphql/templates/object.erb +3 -1
- data/lib/generators/graphql/templates/query_type.erb +3 -3
- data/lib/generators/graphql/templates/scalar.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +10 -35
- data/lib/generators/graphql/templates/union.erb +3 -1
- data/lib/graphql.rb +55 -4
- data/lib/graphql/analysis/analyze_query.rb +7 -0
- data/lib/graphql/analysis/ast.rb +11 -2
- data/lib/graphql/analysis/ast/visitor.rb +9 -1
- data/lib/graphql/argument.rb +3 -3
- data/lib/graphql/backtrace.rb +28 -19
- data/lib/graphql/backtrace/legacy_tracer.rb +56 -0
- data/lib/graphql/backtrace/table.rb +22 -2
- data/lib/graphql/backtrace/tracer.rb +40 -8
- data/lib/graphql/backwards_compatibility.rb +1 -0
- data/lib/graphql/compatibility/execution_specification.rb +1 -0
- data/lib/graphql/compatibility/lazy_execution_specification.rb +2 -0
- data/lib/graphql/compatibility/query_parser_specification.rb +2 -0
- data/lib/graphql/compatibility/schema_parser_specification.rb +2 -0
- data/lib/graphql/dataloader.rb +197 -0
- data/lib/graphql/dataloader/null_dataloader.rb +21 -0
- data/lib/graphql/dataloader/request.rb +24 -0
- data/lib/graphql/dataloader/request_all.rb +22 -0
- data/lib/graphql/dataloader/source.rb +93 -0
- data/lib/graphql/define/assign_global_id_field.rb +2 -2
- data/lib/graphql/define/instance_definable.rb +32 -2
- data/lib/graphql/define/type_definer.rb +5 -5
- data/lib/graphql/deprecated_dsl.rb +5 -0
- data/lib/graphql/enum_type.rb +2 -0
- data/lib/graphql/execution/errors.rb +4 -0
- data/lib/graphql/execution/execute.rb +7 -0
- data/lib/graphql/execution/interpreter.rb +20 -6
- data/lib/graphql/execution/interpreter/arguments.rb +57 -5
- data/lib/graphql/execution/interpreter/arguments_cache.rb +8 -0
- data/lib/graphql/execution/interpreter/handles_raw_value.rb +0 -7
- data/lib/graphql/execution/interpreter/runtime.rb +251 -138
- data/lib/graphql/execution/multiplex.rb +20 -6
- data/lib/graphql/function.rb +4 -0
- data/lib/graphql/input_object_type.rb +2 -0
- data/lib/graphql/integer_decoding_error.rb +17 -0
- data/lib/graphql/interface_type.rb +3 -1
- data/lib/graphql/introspection.rb +96 -0
- data/lib/graphql/introspection/field_type.rb +7 -3
- data/lib/graphql/introspection/input_value_type.rb +6 -0
- data/lib/graphql/introspection/introspection_query.rb +6 -92
- data/lib/graphql/introspection/type_type.rb +7 -3
- data/lib/graphql/invalid_null_error.rb +1 -1
- data/lib/graphql/language/block_string.rb +24 -5
- data/lib/graphql/language/document_from_schema_definition.rb +50 -23
- data/lib/graphql/language/lexer.rb +7 -3
- data/lib/graphql/language/lexer.rl +7 -3
- data/lib/graphql/language/nodes.rb +1 -1
- data/lib/graphql/language/parser.rb +107 -103
- data/lib/graphql/language/parser.y +4 -0
- data/lib/graphql/language/sanitized_printer.rb +59 -26
- data/lib/graphql/name_validator.rb +6 -7
- data/lib/graphql/object_type.rb +2 -0
- data/lib/graphql/pagination/connection.rb +5 -1
- data/lib/graphql/pagination/connections.rb +15 -17
- data/lib/graphql/query.rb +8 -3
- data/lib/graphql/query/context.rb +38 -4
- data/lib/graphql/query/fingerprint.rb +2 -0
- data/lib/graphql/query/serial_execution.rb +1 -0
- data/lib/graphql/query/validation_pipeline.rb +4 -1
- data/lib/graphql/relay/array_connection.rb +2 -2
- data/lib/graphql/relay/base_connection.rb +7 -0
- data/lib/graphql/relay/connection_instrumentation.rb +4 -4
- data/lib/graphql/relay/connection_type.rb +1 -1
- data/lib/graphql/relay/mutation.rb +1 -0
- data/lib/graphql/relay/node.rb +3 -0
- data/lib/graphql/relay/range_add.rb +14 -5
- data/lib/graphql/relay/type_extensions.rb +2 -0
- data/lib/graphql/scalar_type.rb +2 -0
- data/lib/graphql/schema.rb +107 -38
- data/lib/graphql/schema/argument.rb +74 -5
- data/lib/graphql/schema/build_from_definition.rb +203 -86
- data/lib/graphql/schema/default_type_error.rb +2 -0
- data/lib/graphql/schema/directive.rb +76 -0
- data/lib/graphql/schema/directive/deprecated.rb +1 -1
- data/lib/graphql/schema/directive/flagged.rb +57 -0
- data/lib/graphql/schema/enum.rb +3 -0
- data/lib/graphql/schema/enum_value.rb +12 -6
- data/lib/graphql/schema/field.rb +59 -24
- data/lib/graphql/schema/field/connection_extension.rb +11 -9
- data/lib/graphql/schema/field/scope_extension.rb +1 -1
- data/lib/graphql/schema/input_object.rb +38 -25
- data/lib/graphql/schema/interface.rb +2 -1
- data/lib/graphql/schema/late_bound_type.rb +2 -2
- data/lib/graphql/schema/loader.rb +1 -0
- data/lib/graphql/schema/member.rb +4 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +1 -0
- data/lib/graphql/schema/member/build_type.rb +17 -7
- data/lib/graphql/schema/member/has_arguments.rb +70 -51
- data/lib/graphql/schema/member/has_deprecation_reason.rb +25 -0
- data/lib/graphql/schema/member/has_directives.rb +98 -0
- data/lib/graphql/schema/member/has_fields.rb +2 -2
- data/lib/graphql/schema/member/has_validators.rb +31 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +3 -3
- data/lib/graphql/schema/object.rb +11 -0
- data/lib/graphql/schema/printer.rb +5 -4
- data/lib/graphql/schema/relay_classic_mutation.rb +4 -2
- data/lib/graphql/schema/resolver.rb +7 -0
- data/lib/graphql/schema/resolver/has_payload_type.rb +2 -0
- data/lib/graphql/schema/subscription.rb +20 -12
- data/lib/graphql/schema/timeout.rb +29 -15
- data/lib/graphql/schema/timeout_middleware.rb +2 -0
- data/lib/graphql/schema/unique_within_type.rb +1 -2
- data/lib/graphql/schema/validation.rb +10 -0
- data/lib/graphql/schema/validator.rb +163 -0
- data/lib/graphql/schema/validator/exclusion_validator.rb +31 -0
- data/lib/graphql/schema/validator/format_validator.rb +49 -0
- data/lib/graphql/schema/validator/inclusion_validator.rb +33 -0
- data/lib/graphql/schema/validator/length_validator.rb +57 -0
- data/lib/graphql/schema/validator/numericality_validator.rb +71 -0
- data/lib/graphql/schema/validator/required_validator.rb +68 -0
- data/lib/graphql/schema/warden.rb +2 -3
- data/lib/graphql/static_validation.rb +1 -0
- data/lib/graphql/static_validation/all_rules.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +25 -17
- data/lib/graphql/static_validation/rules/input_object_names_are_unique.rb +30 -0
- data/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb +30 -0
- data/lib/graphql/static_validation/validation_timeout_error.rb +25 -0
- data/lib/graphql/static_validation/validator.rb +31 -7
- data/lib/graphql/subscriptions.rb +23 -16
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +21 -7
- data/lib/graphql/tracing.rb +2 -2
- data/lib/graphql/tracing/appoptics_tracing.rb +12 -2
- data/lib/graphql/tracing/platform_tracing.rb +4 -2
- data/lib/graphql/tracing/prometheus_tracing/graphql_collector.rb +4 -1
- data/lib/graphql/tracing/skylight_tracing.rb +1 -1
- data/lib/graphql/types/int.rb +9 -2
- data/lib/graphql/types/iso_8601_date_time.rb +2 -1
- data/lib/graphql/types/relay.rb +11 -3
- data/lib/graphql/types/relay/base_connection.rb +2 -90
- data/lib/graphql/types/relay/base_edge.rb +2 -34
- data/lib/graphql/types/relay/connection_behaviors.rb +123 -0
- data/lib/graphql/types/relay/default_relay.rb +27 -0
- data/lib/graphql/types/relay/edge_behaviors.rb +42 -0
- data/lib/graphql/types/relay/has_node_field.rb +41 -0
- data/lib/graphql/types/relay/has_nodes_field.rb +41 -0
- data/lib/graphql/types/relay/node.rb +2 -4
- data/lib/graphql/types/relay/node_behaviors.rb +15 -0
- data/lib/graphql/types/relay/node_field.rb +1 -19
- data/lib/graphql/types/relay/nodes_field.rb +1 -19
- data/lib/graphql/types/relay/page_info.rb +2 -14
- data/lib/graphql/types/relay/page_info_behaviors.rb +25 -0
- data/lib/graphql/types/string.rb +7 -1
- data/lib/graphql/unauthorized_error.rb +1 -1
- data/lib/graphql/union_type.rb +2 -0
- data/lib/graphql/upgrader/member.rb +1 -0
- data/lib/graphql/upgrader/schema.rb +1 -0
- data/lib/graphql/version.rb +1 -1
- data/readme.md +1 -1
- metadata +38 -9
- data/lib/graphql/types/relay/base_field.rb +0 -22
- data/lib/graphql/types/relay/base_interface.rb +0 -29
- data/lib/graphql/types/relay/base_object.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 433f1170eb17ab192761efcd8c27cf9efe5f952ab47b501baca270e33d6007cd
|
4
|
+
data.tar.gz: c56045f746385ae37ebd0f82116aad10782e9265c13e0e85e39488ef3db02c74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d580c78b6b659602067fcfd3043eff7ef2b20da1d50c1ca2b234614d864e1a232cb65e7456cfdf85764523f30bd5232823ea19b4664208aef875cc68e2e5fc9
|
7
|
+
data.tar.gz: 172bc16fadfeee1f022646498dd2ce359bd885fb96ddbeeab50f7583d27811501e583194dd582a7cf47d63545c2fe00c4fa4625b6b247155f537ff4a6de60ac1
|
@@ -43,9 +43,6 @@ module Graphql
|
|
43
43
|
# post "/graphql", to: "graphql#execute"
|
44
44
|
# ```
|
45
45
|
#
|
46
|
-
# Accept a `--relay` option which adds
|
47
|
-
# The root `node(id: ID!)` field.
|
48
|
-
#
|
49
46
|
# Accept a `--batch` option which adds `GraphQL::Batch` setup.
|
50
47
|
#
|
51
48
|
# Use `--no-graphiql` to skip `graphiql-rails` installation.
|
@@ -79,8 +76,8 @@ module Graphql
|
|
79
76
|
|
80
77
|
class_option :relay,
|
81
78
|
type: :boolean,
|
82
|
-
default:
|
83
|
-
desc: "Include
|
79
|
+
default: true,
|
80
|
+
desc: "Include installation of Relay conventions (nodes, connections, edges)"
|
84
81
|
|
85
82
|
class_option :batch,
|
86
83
|
type: :boolean,
|
@@ -164,7 +161,10 @@ if Rails.env.development?
|
|
164
161
|
RUBY
|
165
162
|
end
|
166
163
|
end
|
164
|
+
end
|
167
165
|
|
166
|
+
if options[:relay]
|
167
|
+
generate("graphql:relay")
|
168
168
|
end
|
169
169
|
|
170
170
|
if gemfile_modified?
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rails/generators/base'
|
3
|
+
require_relative 'core'
|
4
|
+
|
5
|
+
module Graphql
|
6
|
+
module Generators
|
7
|
+
class RelayGenerator < Rails::Generators::Base
|
8
|
+
include Core
|
9
|
+
|
10
|
+
desc "Add base types and fields for Relay-style nodes and connections"
|
11
|
+
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
|
13
|
+
def install_relay
|
14
|
+
# Add Node, `node(id:)`, and `nodes(ids:)`
|
15
|
+
template("node_type.erb", "#{options[:directory]}/types/node_type.rb")
|
16
|
+
in_root do
|
17
|
+
fields = " # Add `node(id: ID!) and `nodes(ids: [ID!]!)`\n include GraphQL::Types::Relay::HasNodeField\n include GraphQL::Types::Relay::HasNodesField\n\n"
|
18
|
+
inject_into_file "#{options[:directory]}/types/query_type.rb", fields, after: /class .*QueryType\s*<\s*[^\s]+?\n/m, force: false
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add connections and edges
|
22
|
+
template("base_connection.erb", "#{options[:directory]}/types/base_connection.rb")
|
23
|
+
template("base_edge.erb", "#{options[:directory]}/types/base_edge.rb")
|
24
|
+
connectionable_type_files = {
|
25
|
+
"#{options[:directory]}/types/base_object.rb" => /class .*BaseObject\s*<\s*[^\s]+?\n/m,
|
26
|
+
"#{options[:directory]}/types/base_union.rb" => /class .*BaseUnion\s*<\s*[^\s]+?\n/m,
|
27
|
+
"#{options[:directory]}/types/base_interface.rb" => /include GraphQL::Schema::Interface\n/m,
|
28
|
+
}
|
29
|
+
in_root do
|
30
|
+
connectionable_type_files.each do |type_class_file, sentinel|
|
31
|
+
inject_into_file type_class_file, " connection_type_class(Types::BaseConnection)\n", after: sentinel, force: false
|
32
|
+
inject_into_file type_class_file, " edge_type_class(Types::BaseEdge)\n", after: sentinel, force: false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Add object ID hooks & connection plugin
|
37
|
+
schema_code = <<-RUBY
|
38
|
+
|
39
|
+
# Relay-style Object Identification:
|
40
|
+
|
41
|
+
# Return a string UUID for `object`
|
42
|
+
def self.id_from_object(object, type_definition, query_ctx)
|
43
|
+
# Here's a simple implementation which:
|
44
|
+
# - joins the type name & object.id
|
45
|
+
# - encodes it with base64:
|
46
|
+
# GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Given a string UUID, find the object
|
50
|
+
def self.object_from_id(id, query_ctx)
|
51
|
+
# For example, to decode the UUIDs generated above:
|
52
|
+
# type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
|
53
|
+
#
|
54
|
+
# Then, based on `type_name` and `id`
|
55
|
+
# find an object in your application
|
56
|
+
# ...
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
inject_into_file schema_file_path, schema_code, before: /^end\n/m, force: false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
2
|
+
module Types
|
3
|
+
class BaseConnection < Types::BaseObject
|
4
|
+
# add `nodes` and `pageInfo` fields, as well as `edge_type(...)` and `node_nullable(...)` overrides
|
5
|
+
include GraphQL::Types::Relay::ConnectionBehaviors
|
6
|
+
end
|
7
|
+
end
|
8
|
+
<% end -%>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
1
2
|
class GraphqlController < ApplicationController
|
2
3
|
# If accessing from outside this domain, nullify the session
|
3
4
|
# This allows for outside API access while preventing CSRF attacks,
|
@@ -48,3 +49,4 @@ class GraphqlController < ApplicationController
|
|
48
49
|
render json: { errors: [{ message: e.message, backtrace: e.backtrace }], data: {} }, status: 500
|
49
50
|
end
|
50
51
|
end
|
52
|
+
<% end -%>
|
@@ -1,6 +1,8 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
1
2
|
module Types
|
2
3
|
class <%= type_ruby_name.split('::')[-1] %> < Types::BaseObject
|
3
|
-
<% if options.node %> implements GraphQL::Relay::Node
|
4
|
+
<% if options.node %> implements GraphQL::Types::Relay::Node
|
4
5
|
<% end %><% normalized_fields.each do |f| %> <%= f.to_ruby %>
|
5
6
|
<% end %> end
|
6
7
|
end
|
8
|
+
<% end -%>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
1
2
|
module Types
|
2
3
|
class QueryType < Types::BaseObject
|
3
4
|
# Add root-level fields here.
|
@@ -9,7 +10,6 @@ module Types
|
|
9
10
|
def test_field
|
10
11
|
"Hello World!"
|
11
12
|
end
|
12
|
-
|
13
|
-
field :node, field: GraphQL::Relay::Node.field
|
14
|
-
<% end %> end
|
13
|
+
end
|
15
14
|
end
|
15
|
+
<% end -%>
|
@@ -1,40 +1,15 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
1
2
|
class <%= schema_name %> < GraphQL::Schema
|
2
3
|
query(Types::QueryType)
|
3
|
-
|
4
|
-
#
|
5
|
-
use GraphQL::
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
use GraphQL::Pagination::Connections
|
10
|
-
<% if options[:relay] %>
|
11
|
-
# Relay Object Identification:
|
12
|
-
|
13
|
-
# Return a string UUID for `object`
|
14
|
-
def self.id_from_object(object, type_definition, query_ctx)
|
15
|
-
# Here's a simple implementation which:
|
16
|
-
# - joins the type name & object.id
|
17
|
-
# - encodes it with base64:
|
18
|
-
# GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Given a string UUID, find the object
|
22
|
-
def self.object_from_id(id, query_ctx)
|
23
|
-
# For example, to decode the UUIDs generated above:
|
24
|
-
# type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
|
25
|
-
#
|
26
|
-
# Then, based on `type_name` and `id`
|
27
|
-
# find an object in your application
|
28
|
-
# ...
|
29
|
-
end
|
30
|
-
|
31
|
-
# Object Resolution
|
32
|
-
def self.resolve_type(type, obj, ctx)
|
4
|
+
<% if options[:batch] %>
|
5
|
+
# GraphQL::Batch setup:
|
6
|
+
use GraphQL::Batch
|
7
|
+
<% end %>
|
8
|
+
# Union and Interface Resolution
|
9
|
+
def self.resolve_type(abstract_type, obj, ctx)
|
33
10
|
# TODO: Implement this function
|
34
|
-
# to return the correct type for `obj`
|
11
|
+
# to return the correct object type for `obj`
|
35
12
|
raise(GraphQL::RequiredImplementationMissingError)
|
36
13
|
end
|
37
|
-
|
38
|
-
|
39
|
-
use GraphQL::Batch
|
40
|
-
<% end %>end
|
14
|
+
end
|
15
|
+
<% end -%>
|
@@ -1,5 +1,7 @@
|
|
1
|
+
<% module_namespacing_when_supported do -%>
|
1
2
|
module Types
|
2
3
|
class <%= type_ruby_name.split('::')[-1] %> < Types::BaseUnion
|
3
|
-
<% if possible_types.any? %> possible_types
|
4
|
+
<% if possible_types.any? %> possible_types <%= normalized_possible_types.join(", ") %>
|
4
5
|
<% end %> end
|
5
6
|
end
|
7
|
+
<% end -%>
|
data/lib/graphql.rb
CHANGED
@@ -21,6 +21,14 @@ module GraphQL
|
|
21
21
|
class RequiredImplementationMissingError < Error
|
22
22
|
end
|
23
23
|
|
24
|
+
class << self
|
25
|
+
def default_parser
|
26
|
+
@default_parser ||= GraphQL::Language::Parser
|
27
|
+
end
|
28
|
+
|
29
|
+
attr_writer :default_parser
|
30
|
+
end
|
31
|
+
|
24
32
|
# Turn a query string or schema definition into an AST
|
25
33
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
26
34
|
# @return [GraphQL::Language::Nodes::Document]
|
@@ -61,6 +69,14 @@ module GraphQL
|
|
61
69
|
end
|
62
70
|
end
|
63
71
|
end
|
72
|
+
|
73
|
+
module StringMatchBackport
|
74
|
+
refine String do
|
75
|
+
def match?(pattern)
|
76
|
+
self =~ pattern
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
64
80
|
end
|
65
81
|
|
66
82
|
# Order matters for these:
|
@@ -94,6 +110,7 @@ require "graphql/execution"
|
|
94
110
|
require "graphql/runtime_type_error"
|
95
111
|
require "graphql/unresolved_type_error"
|
96
112
|
require "graphql/invalid_null_error"
|
113
|
+
require "graphql/pagination"
|
97
114
|
require "graphql/schema"
|
98
115
|
require "graphql/query"
|
99
116
|
require "graphql/directive"
|
@@ -108,19 +125,20 @@ require "graphql/string_type"
|
|
108
125
|
require "graphql/schema/built_in_types"
|
109
126
|
require "graphql/schema/loader"
|
110
127
|
require "graphql/schema/printer"
|
128
|
+
require "graphql/filter"
|
129
|
+
require "graphql/internal_representation"
|
130
|
+
require "graphql/static_validation"
|
111
131
|
require "graphql/introspection"
|
112
132
|
|
113
133
|
require "graphql/analysis_error"
|
114
134
|
require "graphql/coercion_error"
|
115
135
|
require "graphql/invalid_name_error"
|
136
|
+
require "graphql/integer_decoding_error"
|
116
137
|
require "graphql/integer_encoding_error"
|
117
138
|
require "graphql/string_encoding_error"
|
118
|
-
require "graphql/internal_representation"
|
119
|
-
require "graphql/static_validation"
|
120
139
|
require "graphql/version"
|
121
140
|
require "graphql/compatibility"
|
122
141
|
require "graphql/function"
|
123
|
-
require "graphql/filter"
|
124
142
|
require "graphql/subscriptions"
|
125
143
|
require "graphql/parse_error"
|
126
144
|
require "graphql/backtrace"
|
@@ -130,4 +148,37 @@ require "graphql/authorization"
|
|
130
148
|
require "graphql/unauthorized_error"
|
131
149
|
require "graphql/unauthorized_field_error"
|
132
150
|
require "graphql/load_application_object_failed_error"
|
133
|
-
require "graphql/
|
151
|
+
require "graphql/dataloader"
|
152
|
+
|
153
|
+
|
154
|
+
module GraphQL
|
155
|
+
# Ruby has `deprecate_constant`,
|
156
|
+
# but I don't see a way to give a nice error message in that case,
|
157
|
+
# so I'm doing this instead.
|
158
|
+
DEPRECATED_INT_TYPE = INT_TYPE
|
159
|
+
DEPRECATED_FLOAT_TYPE = FLOAT_TYPE
|
160
|
+
DEPRECATED_STRING_TYPE = STRING_TYPE
|
161
|
+
DEPRECATED_BOOLEAN_TYPE = BOOLEAN_TYPE
|
162
|
+
DEPRECATED_ID_TYPE = ID_TYPE
|
163
|
+
|
164
|
+
remove_const :INT_TYPE
|
165
|
+
remove_const :FLOAT_TYPE
|
166
|
+
remove_const :STRING_TYPE
|
167
|
+
remove_const :BOOLEAN_TYPE
|
168
|
+
remove_const :ID_TYPE
|
169
|
+
|
170
|
+
def self.const_missing(const_name)
|
171
|
+
deprecated_const_name = :"DEPRECATED_#{const_name}"
|
172
|
+
if const_defined?(deprecated_const_name)
|
173
|
+
deprecated_type = const_get(deprecated_const_name)
|
174
|
+
deprecated_caller = caller(1, 1).first
|
175
|
+
# Don't warn about internal uses, like `types.Int`
|
176
|
+
if !deprecated_caller.include?("lib/graphql")
|
177
|
+
warn "GraphQL::#{const_name} is deprecated and will be removed in GraphQL-Ruby 2.0, use GraphQL::Types::#{deprecated_type.graphql_name} instead. (from #{deprecated_caller})"
|
178
|
+
end
|
179
|
+
deprecated_type
|
180
|
+
else
|
181
|
+
super
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|