graphql 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/graphql/language/lexer.rb +234 -152
- data/lib/graphql/language/lexer.rl +6 -0
- data/lib/graphql/language/parser.rb +343 -300
- data/lib/graphql/language/parser.y +9 -1
- data/lib/graphql/query/executor.rb +2 -2
- data/lib/graphql/schema.rb +26 -0
- data/lib/graphql/static_validation/type_stack.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- metadata +2 -2
|
@@ -13,7 +13,7 @@ rule
|
|
|
13
13
|
| fragment_definition
|
|
14
14
|
|
|
15
15
|
operation_definition:
|
|
16
|
-
|
|
16
|
+
operation_type operation_name_opt variable_definitions_opt directives_list_opt selection_set {
|
|
17
17
|
return make_node(
|
|
18
18
|
:OperationDefinition, {
|
|
19
19
|
operation_type: val[0],
|
|
@@ -34,6 +34,11 @@ rule
|
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
operation_type:
|
|
38
|
+
QUERY
|
|
39
|
+
| MUTATION
|
|
40
|
+
| SUBSCRIPTION
|
|
41
|
+
|
|
37
42
|
operation_name_opt:
|
|
38
43
|
/* none */ { return nil }
|
|
39
44
|
| name
|
|
@@ -116,6 +121,9 @@ rule
|
|
|
116
121
|
| FRAGMENT
|
|
117
122
|
| TRUE
|
|
118
123
|
| FALSE
|
|
124
|
+
| QUERY
|
|
125
|
+
| MUTATION
|
|
126
|
+
| SUBSCRIPTION
|
|
119
127
|
|
|
120
128
|
arguments_opt:
|
|
121
129
|
/* none */ { return [] }
|
|
@@ -30,8 +30,8 @@ module GraphQL
|
|
|
30
30
|
return {} if operation.nil?
|
|
31
31
|
|
|
32
32
|
op_type = operation.operation_type
|
|
33
|
-
root_type = query.schema.
|
|
34
|
-
execution_strategy_class = query.schema.
|
|
33
|
+
root_type = query.schema.root_type_for_operation(op_type)
|
|
34
|
+
execution_strategy_class = query.schema.execution_strategy_for_operation(op_type)
|
|
35
35
|
execution_strategy = execution_strategy_class.new
|
|
36
36
|
|
|
37
37
|
query.context.execution_strategy = execution_strategy
|
data/lib/graphql/schema.rb
CHANGED
|
@@ -92,5 +92,31 @@ module GraphQL
|
|
|
92
92
|
@interface_possible_types ||= GraphQL::Schema::PossibleTypes.new(self)
|
|
93
93
|
@interface_possible_types.possible_types(type_defn)
|
|
94
94
|
end
|
|
95
|
+
|
|
96
|
+
def root_type_for_operation(operation)
|
|
97
|
+
case operation
|
|
98
|
+
when "query"
|
|
99
|
+
query
|
|
100
|
+
when "mutation"
|
|
101
|
+
mutation
|
|
102
|
+
when "subscription"
|
|
103
|
+
subscription
|
|
104
|
+
else
|
|
105
|
+
raise ArgumentError, "unknown operation type: #{operation}"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def execution_strategy_for_operation(operation)
|
|
110
|
+
case operation
|
|
111
|
+
when "query"
|
|
112
|
+
query_execution_strategy
|
|
113
|
+
when "mutation"
|
|
114
|
+
mutation_execution_strategy
|
|
115
|
+
when "subscription"
|
|
116
|
+
subscription_execution_strategy
|
|
117
|
+
else
|
|
118
|
+
raise ArgumentError, "unknown operation type: #{operation}"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
95
121
|
end
|
|
96
122
|
end
|
|
@@ -76,7 +76,7 @@ module GraphQL
|
|
|
76
76
|
class OperationDefinitionStrategy
|
|
77
77
|
def push(stack, node)
|
|
78
78
|
# eg, QueryType, MutationType
|
|
79
|
-
object_type = stack.schema.
|
|
79
|
+
object_type = stack.schema.root_type_for_operation(node.operation_type)
|
|
80
80
|
stack.object_types.push(object_type)
|
|
81
81
|
end
|
|
82
82
|
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.14.
|
|
4
|
+
version: 0.14.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: codeclimate-test-reporter
|