graphql 1.8.0.pre2 → 1.8.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql.rb +1 -1
- data/lib/graphql/deprecated_dsl.rb +2 -0
- data/lib/graphql/enum_type.rb +1 -1
- data/lib/graphql/field.rb +10 -1
- data/lib/graphql/input_object_type.rb +3 -1
- data/lib/graphql/introspection.rb +3 -10
- data/lib/graphql/introspection/base_object.rb +15 -0
- data/lib/graphql/introspection/directive_location_enum.rb +11 -7
- data/lib/graphql/introspection/directive_type.rb +23 -16
- data/lib/graphql/introspection/dynamic_fields.rb +11 -0
- data/lib/graphql/introspection/entry_points.rb +29 -0
- data/lib/graphql/introspection/enum_value_type.rb +16 -11
- data/lib/graphql/introspection/field_type.rb +21 -12
- data/lib/graphql/introspection/input_value_type.rb +26 -23
- data/lib/graphql/introspection/schema_field.rb +7 -2
- data/lib/graphql/introspection/schema_type.rb +36 -22
- data/lib/graphql/introspection/type_by_name_field.rb +10 -2
- data/lib/graphql/introspection/type_kind_enum.rb +10 -6
- data/lib/graphql/introspection/type_type.rb +85 -23
- data/lib/graphql/introspection/typename_field.rb +1 -0
- data/lib/graphql/language.rb +1 -0
- data/lib/graphql/language/document_from_schema_definition.rb +129 -37
- data/lib/graphql/language/generation.rb +3 -182
- data/lib/graphql/language/nodes.rb +12 -2
- data/lib/graphql/language/parser.rb +63 -55
- data/lib/graphql/language/parser.y +2 -1
- data/lib/graphql/language/printer.rb +351 -0
- data/lib/graphql/object_type.rb +1 -1
- data/lib/graphql/query.rb +1 -1
- data/lib/graphql/query/arguments.rb +24 -8
- data/lib/graphql/query/context.rb +3 -0
- data/lib/graphql/query/literal_input.rb +4 -1
- data/lib/graphql/railtie.rb +28 -6
- data/lib/graphql/schema.rb +42 -7
- data/lib/graphql/schema/enum.rb +1 -0
- data/lib/graphql/schema/field.rb +26 -5
- data/lib/graphql/schema/field/dynamic_resolve.rb +18 -9
- data/lib/graphql/schema/input_object.rb +2 -2
- data/lib/graphql/schema/introspection_system.rb +93 -0
- data/lib/graphql/schema/late_bound_type.rb +32 -0
- data/lib/graphql/schema/member.rb +21 -1
- data/lib/graphql/schema/member/build_type.rb +8 -6
- data/lib/graphql/schema/member/has_fields.rb +1 -1
- data/lib/graphql/schema/member/instrumentation.rb +3 -1
- data/lib/graphql/schema/member/list_type_proxy.rb +4 -0
- data/lib/graphql/schema/member/non_null_type_proxy.rb +4 -0
- data/lib/graphql/schema/object.rb +2 -1
- data/lib/graphql/schema/printer.rb +33 -266
- data/lib/graphql/schema/traversal.rb +74 -6
- data/lib/graphql/schema/validation.rb +3 -2
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +6 -6
- data/lib/graphql/tracing/scout_tracing.rb +2 -2
- data/lib/graphql/upgrader/member.rb +463 -63
- data/lib/graphql/version.rb +1 -1
- data/spec/fixtures/upgrader/blame_range.original.rb +43 -0
- data/spec/fixtures/upgrader/blame_range.transformed.rb +31 -0
- data/spec/fixtures/upgrader/subscribable.original.rb +51 -0
- data/spec/fixtures/upgrader/subscribable.transformed.rb +46 -0
- data/spec/fixtures/upgrader/type_x.original.rb +35 -0
- data/spec/fixtures/upgrader/type_x.transformed.rb +35 -0
- data/spec/graphql/language/document_from_schema_definition_spec.rb +729 -296
- data/spec/graphql/language/generation_spec.rb +21 -186
- data/spec/graphql/language/nodes_spec.rb +21 -0
- data/spec/graphql/language/printer_spec.rb +203 -0
- data/spec/graphql/query/arguments_spec.rb +14 -4
- data/spec/graphql/query/context_spec.rb +17 -0
- data/spec/graphql/schema/build_from_definition_spec.rb +13 -4
- data/spec/graphql/schema/field_spec.rb +14 -0
- data/spec/graphql/schema/introspection_system_spec.rb +39 -0
- data/spec/graphql/schema/object_spec.rb +12 -1
- data/spec/graphql/schema/printer_spec.rb +14 -14
- data/spec/graphql/tracing/platform_tracing_spec.rb +2 -2
- data/spec/graphql/upgrader/member_spec.rb +274 -62
- data/spec/support/jazz.rb +75 -3
- metadata +38 -9
- data/lib/graphql/introspection/arguments_field.rb +0 -7
- data/lib/graphql/introspection/enum_values_field.rb +0 -18
- data/lib/graphql/introspection/fields_field.rb +0 -13
- data/lib/graphql/introspection/input_fields_field.rb +0 -12
- data/lib/graphql/introspection/interfaces_field.rb +0 -11
- data/lib/graphql/introspection/of_type_field.rb +0 -6
- data/lib/graphql/introspection/possible_types_field.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a150383d3c4ffcaf126e675d8e844f93c4d2244
|
4
|
+
data.tar.gz: 76b98bf791afc9ca8cd0eb9caf9798005d058169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4850a2d2c7872936c2ef09e016e6da4d6afba9bc554f76f08cc7f747d38e336e183ce201f184053364c468241b25442483ac83eab4e9bb63da2a74f19a67a202
|
7
|
+
data.tar.gz: 853775ca411cab71eae69b917071ebb0c03c61d1a4557d38ff8fb4410b05da3e34dad381098ba41417b03e39114d6e1ba36aab441fc3297fffb356d0222d1b73
|
data/lib/graphql.rb
CHANGED
@@ -90,7 +90,6 @@ require "graphql/string_type"
|
|
90
90
|
require "graphql/directive"
|
91
91
|
require "graphql/name_validator"
|
92
92
|
|
93
|
-
require "graphql/introspection"
|
94
93
|
require "graphql/language"
|
95
94
|
require "graphql/analysis"
|
96
95
|
require "graphql/tracing"
|
@@ -99,6 +98,7 @@ require "graphql/relay"
|
|
99
98
|
require "graphql/schema"
|
100
99
|
require "graphql/schema/loader"
|
101
100
|
require "graphql/schema/printer"
|
101
|
+
require "graphql/introspection"
|
102
102
|
|
103
103
|
require "graphql/analysis_error"
|
104
104
|
require "graphql/coercion_error"
|
data/lib/graphql/enum_type.rb
CHANGED
data/lib/graphql/field.rb
CHANGED
@@ -131,6 +131,7 @@ module GraphQL
|
|
131
131
|
:relay_nodes_field,
|
132
132
|
:subscription_scope,
|
133
133
|
:trace,
|
134
|
+
:introspection,
|
134
135
|
argument: GraphQL::Define::AssignArgument
|
135
136
|
|
136
137
|
ensure_defined(
|
@@ -138,7 +139,8 @@ module GraphQL
|
|
138
139
|
:mutation, :arguments, :complexity, :function,
|
139
140
|
:resolve, :resolve=, :lazy_resolve, :lazy_resolve=, :lazy_resolve_proc, :resolve_proc,
|
140
141
|
:type, :type=, :name=, :property=, :hash_key=,
|
141
|
-
:relay_node_field, :relay_nodes_field, :edges?, :edge_class, :subscription_scope
|
142
|
+
:relay_node_field, :relay_nodes_field, :edges?, :edge_class, :subscription_scope,
|
143
|
+
:introspection?
|
142
144
|
)
|
143
145
|
|
144
146
|
# @return [Boolean] True if this is the Relay find-by-id field
|
@@ -183,6 +185,7 @@ module GraphQL
|
|
183
185
|
attr_accessor :arguments_class
|
184
186
|
|
185
187
|
attr_writer :connection
|
188
|
+
attr_writer :introspection
|
186
189
|
|
187
190
|
# @return [nil, String] Prefix for subscription names from this field
|
188
191
|
attr_accessor :subscription_scope
|
@@ -217,6 +220,7 @@ module GraphQL
|
|
217
220
|
@connection_max_page_size = nil
|
218
221
|
@edge_class = nil
|
219
222
|
@trace = nil
|
223
|
+
@introspection = false
|
220
224
|
end
|
221
225
|
|
222
226
|
def initialize_copy(other)
|
@@ -225,6 +229,11 @@ module GraphQL
|
|
225
229
|
@arguments = other.arguments.dup
|
226
230
|
end
|
227
231
|
|
232
|
+
# @return [Boolean] Is this field a predefined introspection field?
|
233
|
+
def introspection?
|
234
|
+
@introspection
|
235
|
+
end
|
236
|
+
|
228
237
|
# Get a value for this field
|
229
238
|
# @example resolving a field value
|
230
239
|
# field.resolve(obj, args, ctx)
|
@@ -84,6 +84,7 @@ module GraphQL
|
|
84
84
|
|
85
85
|
def coerce_non_null_input(value, ctx)
|
86
86
|
input_values = {}
|
87
|
+
defaults_used = Set.new
|
87
88
|
|
88
89
|
arguments.each do |input_key, input_field_defn|
|
89
90
|
field_value = value[input_key]
|
@@ -93,10 +94,11 @@ module GraphQL
|
|
93
94
|
input_values[input_key] = input_field_defn.prepare(coerced_value, ctx)
|
94
95
|
elsif input_field_defn.default_value?
|
95
96
|
input_values[input_key] = input_field_defn.default_value
|
97
|
+
defaults_used << input_key
|
96
98
|
end
|
97
99
|
end
|
98
100
|
|
99
|
-
arguments_class.new(input_values, context: ctx)
|
101
|
+
arguments_class.new(input_values, context: ctx, defaults_used: defaults_used)
|
100
102
|
end
|
101
103
|
|
102
104
|
# @api private
|
@@ -4,25 +4,18 @@ module GraphQL
|
|
4
4
|
end
|
5
5
|
end
|
6
6
|
|
7
|
+
require "graphql/introspection/base_object"
|
7
8
|
require "graphql/introspection/typename_field"
|
8
9
|
require "graphql/introspection/input_value_type"
|
9
10
|
require "graphql/introspection/enum_value_type"
|
10
11
|
require "graphql/introspection/type_kind_enum"
|
11
|
-
|
12
|
-
require "graphql/introspection/fields_field"
|
13
|
-
require "graphql/introspection/of_type_field"
|
14
|
-
require "graphql/introspection/input_fields_field"
|
15
|
-
require "graphql/introspection/possible_types_field"
|
16
|
-
require "graphql/introspection/enum_values_field"
|
17
|
-
require "graphql/introspection/interfaces_field"
|
18
|
-
|
19
12
|
require "graphql/introspection/type_type"
|
20
|
-
require "graphql/introspection/arguments_field"
|
21
13
|
require "graphql/introspection/field_type"
|
22
|
-
|
23
14
|
require "graphql/introspection/directive_location_enum"
|
24
15
|
require "graphql/introspection/directive_type"
|
25
16
|
require "graphql/introspection/schema_type"
|
26
17
|
require "graphql/introspection/schema_field"
|
27
18
|
require "graphql/introspection/type_by_name_field"
|
28
19
|
require "graphql/introspection/introspection_query"
|
20
|
+
require "graphql/introspection/dynamic_fields"
|
21
|
+
require "graphql/introspection/entry_points"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class BaseObject < GraphQL::Schema::Object
|
5
|
+
def self.field(*args, **kwargs, &block)
|
6
|
+
kwargs[:introspection] = true
|
7
|
+
super(*args, **kwargs, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.inherited(child_class)
|
11
|
+
child_class.introspection(true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class DirectiveLocationEnum < GraphQL::Schema::Enum
|
5
|
+
graphql_name "__DirectiveLocation"
|
6
|
+
description "A Directive can be adjacent to many parts of the GraphQL language, "\
|
7
|
+
"a __DirectiveLocation describes one such possible adjacencies."
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
GraphQL::Directive::LOCATIONS.each do |location|
|
10
|
+
value(location.to_s, GraphQL::Directive::LOCATION_DESCRIPTIONS[location], value: location)
|
11
|
+
end
|
12
|
+
introspection true
|
13
|
+
end
|
9
14
|
end
|
10
|
-
introspection true
|
11
15
|
end
|
@@ -1,18 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class DirectiveType < Introspection::BaseObject
|
5
|
+
graphql_name "__Directive"
|
6
|
+
description "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document."\
|
7
|
+
"\n\n"\
|
8
|
+
"In some cases, you need to provide options to alter GraphQL's execution behavior "\
|
9
|
+
"in ways field arguments will not suffice, such as conditionally including or "\
|
10
|
+
"skipping a field. Directives provide this by describing additional information "\
|
11
|
+
"to the executor."
|
12
|
+
field :name, String, null: false
|
13
|
+
field :description, String, null: true
|
14
|
+
field :locations, [GraphQL::Schema::LateBoundType.new("__DirectiveLocation")], null: false
|
15
|
+
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false
|
16
|
+
field :on_operation, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_operation?
|
17
|
+
field :on_fragment, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_fragment?
|
18
|
+
field :on_field, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_field?
|
19
|
+
|
20
|
+
def args
|
21
|
+
@context.warden.arguments(@object)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
18
25
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class DynamicFields < GraphQL::Schema::Object
|
5
|
+
field :__typename, String, "The name of this type", null: false, extras: [:irep_node]
|
6
|
+
def __typename(irep_node:)
|
7
|
+
irep_node.owner_type.name
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class EntryPoints < GraphQL::Schema::Object
|
5
|
+
field :__schema, GraphQL::Schema::LateBoundType.new("__Schema"), "This GraphQL schema", null: false
|
6
|
+
field :__type, GraphQL::Schema::LateBoundType.new("__Type"), "A type in the GraphQL system", null: true do
|
7
|
+
argument :name, String, required: true
|
8
|
+
end
|
9
|
+
|
10
|
+
def __schema
|
11
|
+
# Apply wrapping manually since this field isn't wrapped by instrumentation
|
12
|
+
schema = @context.query.schema
|
13
|
+
schema_type = schema.introspection_system.schema_type
|
14
|
+
schema_type.metadata[:object_class].new(schema, @context)
|
15
|
+
end
|
16
|
+
|
17
|
+
def __type(name:)
|
18
|
+
type = @context.warden.get_type(name)
|
19
|
+
if type
|
20
|
+
# Apply wrapping manually since this field isn't wrapped by instrumentation
|
21
|
+
type_type = @context.schema.introspection_system.type_type
|
22
|
+
type_type.metadata[:object_class].new(type, @context)
|
23
|
+
else
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class EnumValueType < Introspection::BaseObject
|
5
|
+
graphql_name "__EnumValue"
|
6
|
+
description "One possible value for a given Enum. Enum values are unique values, not a "\
|
7
|
+
"placeholder for a string or numeric value. However an Enum value is returned in "\
|
8
|
+
"a JSON response as a string."
|
9
|
+
field :name, String, null: false
|
10
|
+
field :description, String, null: true
|
11
|
+
field :is_deprecated, Boolean, null: false
|
12
|
+
field :deprecation_reason, String, null: true
|
13
|
+
|
14
|
+
def is_deprecated
|
15
|
+
!!@object.deprecation_reason
|
16
|
+
end
|
17
|
+
end
|
11
18
|
end
|
12
|
-
field :deprecationReason, types.String, property: :deprecation_reason
|
13
|
-
introspection true
|
14
19
|
end
|
@@ -1,15 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class FieldType < Introspection::BaseObject
|
5
|
+
graphql_name "__Field"
|
6
|
+
description "Object and Interface types are described by a list of Fields, each of which has "\
|
7
|
+
"a name, potentially a list of arguments, and a return type."
|
8
|
+
field :name, String, null: false
|
9
|
+
field :description, String, null: true
|
10
|
+
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false
|
11
|
+
field :type, GraphQL::Schema::LateBoundType.new("__Type"), null: false
|
12
|
+
field :is_deprecated, Boolean, null: false
|
13
|
+
field :deprecation_reason, String, null: true
|
14
|
+
|
15
|
+
def is_deprecated
|
16
|
+
!!@object.deprecation_reason
|
17
|
+
end
|
18
|
+
|
19
|
+
def args
|
20
|
+
@context.warden.arguments(@object)
|
21
|
+
end
|
22
|
+
end
|
12
23
|
end
|
13
|
-
field :deprecationReason, types.String, property: :deprecation_reason
|
14
|
-
introspection true
|
15
24
|
end
|
@@ -1,30 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
coerced_default_value
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class InputValueType < Introspection::BaseObject
|
5
|
+
graphql_name "__InputValue"
|
6
|
+
description "Arguments provided to Fields or Directives and the input fields of an "\
|
7
|
+
"InputObject are represented as Input Values which describe their type and "\
|
8
|
+
"optionally a default value."
|
9
|
+
field :name, String, null: false
|
10
|
+
field :description, String, null: true
|
11
|
+
field :type, GraphQL::Schema::LateBoundType.new("__Type"), null: false
|
12
|
+
field :default_value, String, "A GraphQL-formatted string representing the default value for this input value.", null: true
|
13
|
+
|
14
|
+
def default_value
|
15
|
+
if @object.default_value?
|
16
|
+
value = @object.default_value
|
17
|
+
if value.nil?
|
18
|
+
'null'
|
20
19
|
else
|
21
|
-
|
20
|
+
coerced_default_value = @object.type.coerce_result(value, @context)
|
21
|
+
if @object.type.unwrap.is_a?(GraphQL::EnumType)
|
22
|
+
coerced_default_value
|
23
|
+
else
|
24
|
+
GraphQL::Language.serialize(coerced_default_value)
|
25
|
+
end
|
22
26
|
end
|
27
|
+
else
|
28
|
+
nil
|
23
29
|
end
|
24
|
-
else
|
25
|
-
nil
|
26
30
|
end
|
27
|
-
|
31
|
+
end
|
28
32
|
end
|
29
|
-
introspection true
|
30
33
|
end
|
@@ -4,8 +4,13 @@ module GraphQL
|
|
4
4
|
SchemaField = GraphQL::Field.define do
|
5
5
|
name("__schema")
|
6
6
|
description("This GraphQL schema")
|
7
|
-
type(
|
8
|
-
resolve ->(o, a, ctx) {
|
7
|
+
type(GraphQL::Schema::LateBoundType.new("__Schema").to_non_null_type)
|
8
|
+
resolve ->(o, a, ctx) {
|
9
|
+
# Apply wrapping manually since this field isn't wrapped by instrumentation
|
10
|
+
schema = ctx.query.schema
|
11
|
+
schema_type = schema.introspection_system.schema_type
|
12
|
+
schema_type.metadata[:object_class].new(schema, ctx.query.context)
|
13
|
+
}
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
@@ -1,29 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
resolve ->(obj, arg, ctx) { ctx.warden.types }
|
10
|
-
end
|
2
|
+
module GraphQL
|
3
|
+
module Introspection
|
4
|
+
class SchemaType < Introspection::BaseObject
|
5
|
+
graphql_name "__Schema"
|
6
|
+
description "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all "\
|
7
|
+
"available types and directives on the server, as well as the entry points for "\
|
8
|
+
"query, mutation, and subscription operations."
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
field :types, [GraphQL::Schema::LateBoundType.new("__Type")], "A list of all types supported by this server.", null: false
|
11
|
+
field :queryType, GraphQL::Schema::LateBoundType.new("__Type"), "The type that query operations will be rooted at.", null: false
|
12
|
+
field :mutationType, GraphQL::Schema::LateBoundType.new("__Type"), "If this server supports mutation, the type that mutation operations will be rooted at.", null: true
|
13
|
+
field :subscriptionType, GraphQL::Schema::LateBoundType.new("__Type"), "If this server support subscription, the type that subscription operations will be rooted at.", null: true
|
14
|
+
field :directives, [GraphQL::Schema::LateBoundType.new("__Directive")], "A list of all directives supported by this server.", null: false
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def types
|
17
|
+
@context.warden.types
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def query_type
|
21
|
+
permitted_root_type("query")
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def mutation_type
|
25
|
+
permitted_root_type("mutation")
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
def subscription_type
|
29
|
+
permitted_root_type("subscription")
|
30
|
+
end
|
31
|
+
|
32
|
+
def directives
|
33
|
+
@object.directives.values
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def permitted_root_type(op_type)
|
39
|
+
@context.warden.root_type_for_operation(op_type)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
29
43
|
end
|