graphql 1.9.4 → 1.9.5
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 +5 -5
- data/lib/graphql/execution/execute.rb +3 -0
- data/lib/graphql/execution/interpreter/runtime.rb +2 -2
- data/lib/graphql/execution/lookahead.rb +57 -22
- data/lib/graphql/introspection/input_value_type.rb +5 -1
- data/lib/graphql/language/parser.rb +57 -54
- data/lib/graphql/language/parser.y +12 -9
- data/lib/graphql/language/token.rb +1 -1
- data/lib/graphql/language/visitor.rb +1 -1
- data/lib/graphql/query/arguments.rb +3 -3
- data/lib/graphql/query/context.rb +6 -6
- data/lib/graphql/query/variable_validation_error.rb +14 -0
- data/lib/graphql/schema.rb +2 -2
- data/lib/graphql/schema/argument.rb +1 -1
- data/lib/graphql/schema/field.rb +6 -3
- data/lib/graphql/schema/object.rb +2 -2
- data/lib/graphql/schema/relay_classic_mutation.rb +1 -1
- data/lib/graphql/schema/rescue_middleware.rb +7 -2
- data/lib/graphql/schema/validation.rb +9 -4
- data/lib/graphql/static_validation/base_visitor.rb +8 -5
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +3 -1
- data/lib/graphql/tracing.rb +3 -3
- data/lib/graphql/types.rb +1 -0
- data/lib/graphql/types/json.rb +25 -0
- data/lib/graphql/types/relay/base_edge.rb +3 -2
- data/lib/graphql/unauthorized_field_error.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/dummy/Gemfile.lock +157 -0
- data/spec/dummy/log/test.log +199 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4w/4wzXRZrAkwKdgYaSE0pid5eB-fer8vSfSku_NPg4rMA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7I/7IHVBiJT06QSpgLpLoJIxboQ0B-D_tMTxsvoezBTV3Q.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AK/AKzz1u6bGb4auXcrObA_g5LL-oV0ejNGa448AgAi_WQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ET/ETW4uxvaYpruL8y6_ZptUH82ZowMaHIqvg5WexBFdEM.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F1/F1TWpjjyA56k9Z90n5B3xRn7DUdGjX73QCkYC6k07JQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8MUNRzORGFgr329fNM0xLaoWCXdv3BIalT7dsvLfjs.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KB/KB07ZaKNC5uXJ7TjLi-WqnY6g7dq8wWp_8N3HNjBNxg.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ms/MsKSimH_UCB-H1tLvDABDHuvGciuoW6kVqQWDrXU5FQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mt/Mtci-Kim50aPOmeClD4AIicKn1d1WJ0n454IjSd94sk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QH/QHt3Tc1Y6M66Oo_pDuMyWrQNs4Pp3SMeZR5K1wJj2Ts.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XU/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ZI/ZIof7mZxWWCnraIFOCuV6a8QRWzKJXJnx2Xd7C0ZyX0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cG/cGc_puuPS5pZKgUcy1Y_i1L6jl5UtsiIrMH59rTzR6c.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/df/dfro_B6bx3KP1Go-7jEOqqZ2j4hVRseXIc3es9PKQno.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jO/jO1DfbqnG0mTULsjJJANc3fefrG2zt7DIMmcptMT628.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r9/r9iU1l58a6rxkZSW5RSC52_tD-_UQuHxoMVnkfJ7Mhs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xi/xitPPFfPIyDMpaznV0sBBcw8eSCV8PJcLLWin78sCgE.cache +0 -0
- data/spec/dummy/tmp/screenshots/failures_test_it_handles_subscriptions.png +0 -0
- data/spec/graphql/authorization_spec.rb +47 -14
- data/spec/graphql/execution/lookahead_spec.rb +29 -2
- data/spec/graphql/function_spec.rb +28 -5
- data/spec/graphql/introspection/input_value_type_spec.rb +40 -1
- data/spec/graphql/language/parser_spec.rb +8 -0
- data/spec/graphql/query/executor_spec.rb +30 -3
- data/spec/graphql/schema/object_spec.rb +71 -0
- data/spec/graphql/schema/relay_classic_mutation_spec.rb +18 -0
- data/spec/graphql/schema/rescue_middleware_spec.rb +14 -0
- data/spec/graphql/schema/warden_spec.rb +1 -1
- data/spec/graphql/types/relay/base_edge_spec.rb +33 -0
- data/spec/integration/rails/graphql/schema_spec.rb +13 -0
- data/spec/integration/tmp/app/graphql/types/bird_type.rb +7 -0
- data/spec/support/dummy/schema.rb +19 -0
- data/spec/support/jazz.rb +16 -14
- metadata +57 -7
|
@@ -63,7 +63,46 @@ describe GraphQL::Introspection::InputValueType do
|
|
|
63
63
|
field = cheese_type['data']['__type']['fields'].detect { |f| f['name'] == 'similarCheese' }
|
|
64
64
|
arg = field['args'].detect { |a| a['name'] == 'nullableSource' }
|
|
65
65
|
|
|
66
|
-
assert_equal('[
|
|
66
|
+
assert_equal('[COW]', arg['defaultValue'])
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "supports list of enum default values" do
|
|
70
|
+
schema = GraphQL::Schema.from_definition(%|
|
|
71
|
+
type Query {
|
|
72
|
+
hello(enums: [MyEnum] = [A, B]): String
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
enum MyEnum {
|
|
76
|
+
A
|
|
77
|
+
B
|
|
78
|
+
}
|
|
79
|
+
|)
|
|
80
|
+
|
|
81
|
+
result = schema.execute(%|
|
|
82
|
+
{
|
|
83
|
+
__type(name: "Query") {
|
|
84
|
+
fields {
|
|
85
|
+
args {
|
|
86
|
+
defaultValue
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|)
|
|
92
|
+
|
|
93
|
+
expected = {
|
|
94
|
+
"data" => {
|
|
95
|
+
"__type" => {
|
|
96
|
+
"fields" => [{
|
|
97
|
+
"args" => [{
|
|
98
|
+
"defaultValue" => "[A, B]"
|
|
99
|
+
}]
|
|
100
|
+
}]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
assert_equal expected, result
|
|
67
106
|
end
|
|
68
107
|
|
|
69
108
|
it "supports null default values" do
|
|
@@ -129,6 +129,14 @@ describe GraphQL::Language::Parser do
|
|
|
129
129
|
assert_equal schema_string, document.to_query_string
|
|
130
130
|
end
|
|
131
131
|
|
|
132
|
+
describe "parse errors" do
|
|
133
|
+
it "raises parse errors for nil" do
|
|
134
|
+
assert_raises(GraphQL::ParseError) {
|
|
135
|
+
GraphQL.parse(nil)
|
|
136
|
+
}
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
132
140
|
describe ".parse_file" do
|
|
133
141
|
it "assigns filename to all nodes" do
|
|
134
142
|
example_filename = "spec/support/parser/filename_example.graphql"
|
|
@@ -198,6 +198,32 @@ describe GraphQL::Query::Executor do
|
|
|
198
198
|
schema.remove_handler(RuntimeError)
|
|
199
199
|
end
|
|
200
200
|
|
|
201
|
+
it "adds to the errors key" do
|
|
202
|
+
expected = {
|
|
203
|
+
"data" => {"error" => nil},
|
|
204
|
+
"errors"=>[
|
|
205
|
+
{
|
|
206
|
+
"message"=>"Error was handled!",
|
|
207
|
+
"locations" => [{"line"=>1, "column"=>17}],
|
|
208
|
+
"path"=>["error"]
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
assert_equal(expected, result)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
describe "if the schema has a rescue handler with an instance of GraphQL::ExecutionError as an argument" do
|
|
217
|
+
before do
|
|
218
|
+
# HACK: reach to the underlying instance to perform a side-effect
|
|
219
|
+
schema.graphql_definition.rescue_from(RuntimeError) { GraphQL::ExecutionError.new("Error was handled!", extensions: { code: "DUMMY_ERROR" }) }
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
after do
|
|
223
|
+
# remove the handler from the middleware:
|
|
224
|
+
schema.remove_handler(RuntimeError)
|
|
225
|
+
end
|
|
226
|
+
|
|
201
227
|
it "adds to the errors key" do
|
|
202
228
|
expected = {
|
|
203
229
|
"data" => {"error" => nil},
|
|
@@ -205,7 +231,8 @@ describe GraphQL::Query::Executor do
|
|
|
205
231
|
{
|
|
206
232
|
"message"=>"Error was handled!",
|
|
207
233
|
"locations" => [{"line"=>1, "column"=>17}],
|
|
208
|
-
"path"=>["error"]
|
|
234
|
+
"path"=>["error"],
|
|
235
|
+
"extensions"=>{code: "DUMMY_ERROR"}
|
|
209
236
|
}
|
|
210
237
|
]
|
|
211
238
|
}
|
|
@@ -275,7 +302,7 @@ describe GraphQL::Query::Executor do
|
|
|
275
302
|
expected = {
|
|
276
303
|
"errors"=>[
|
|
277
304
|
{
|
|
278
|
-
"message" => "Variable input of type ReplaceValuesInput! was provided invalid value",
|
|
305
|
+
"message" => "Variable input of type ReplaceValuesInput! was provided invalid value for values (Expected value to not be null)",
|
|
279
306
|
"locations" => [{ "line" => 1, "column" => 13 }],
|
|
280
307
|
"extensions" => {
|
|
281
308
|
"value" => {},
|
|
@@ -295,7 +322,7 @@ describe GraphQL::Query::Executor do
|
|
|
295
322
|
expected = {
|
|
296
323
|
"errors"=>[
|
|
297
324
|
{
|
|
298
|
-
"message" => "Variable input of type [DairyProductInput] was provided invalid value",
|
|
325
|
+
"message" => "Variable input of type [DairyProductInput] was provided invalid value for 0.foo (Field is not defined on DairyProductInput), 0.source (Expected value to not be null)",
|
|
299
326
|
"locations" => [{ "line" => 1, "column" => 10 }],
|
|
300
327
|
"extensions" => {
|
|
301
328
|
"value" => [{ "foo" => "bar" }],
|
|
@@ -105,6 +105,77 @@ describe GraphQL::Schema::Object do
|
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
describe "using GraphQL::Function" do
|
|
109
|
+
new_test_func_payload = Class.new(GraphQL::Schema::Object) do
|
|
110
|
+
graphql_name "TestFuncPayload"
|
|
111
|
+
field :name, String, null: false
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "returns data on a field" do
|
|
115
|
+
new_func_class = Class.new(GraphQL::Function) do
|
|
116
|
+
argument :name, GraphQL::STRING_TYPE
|
|
117
|
+
type new_test_func_payload
|
|
118
|
+
|
|
119
|
+
def call(o, a, c)
|
|
120
|
+
{ name: a[:name] }
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
new_object_class = Class.new(GraphQL::Schema::Object) do
|
|
125
|
+
graphql_name "GraphQL"
|
|
126
|
+
field :test, function: new_func_class.new
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
schema = Class.new(GraphQL::Schema) do
|
|
130
|
+
query(new_object_class)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
query_str = <<-GRAPHQL
|
|
134
|
+
{
|
|
135
|
+
test(name: "graphql") {
|
|
136
|
+
name
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
GRAPHQL
|
|
140
|
+
res = schema.execute(query_str)
|
|
141
|
+
assert_equal "graphql", res["data"]["test"]["name"]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it "returns data on a connection" do
|
|
145
|
+
new_func_class = Class.new(GraphQL::Function) do
|
|
146
|
+
argument :name, GraphQL::STRING_TYPE
|
|
147
|
+
type new_test_func_payload.connection_type
|
|
148
|
+
|
|
149
|
+
def call(o, a, c)
|
|
150
|
+
[{ name: a[:name] }]
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
new_object_class = Class.new(GraphQL::Schema::Object) do
|
|
155
|
+
graphql_name "GraphQL"
|
|
156
|
+
field :test_conn, function: new_func_class.new
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
schema = Class.new(GraphQL::Schema) do
|
|
160
|
+
query(new_object_class)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
query_str = <<-GRAPHQL
|
|
164
|
+
{
|
|
165
|
+
testConn(name: "graphql") {
|
|
166
|
+
edges {
|
|
167
|
+
node {
|
|
168
|
+
name
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
GRAPHQL
|
|
174
|
+
res = schema.execute(query_str)
|
|
175
|
+
assert_equal "graphql", res["data"]["testConn"]["edges"][0]["node"]["name"]
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
108
179
|
describe "wrapping a Hash" do
|
|
109
180
|
it "automatically looks up symbol and string keys" do
|
|
110
181
|
query_str = <<-GRAPHQL
|
|
@@ -37,6 +37,10 @@ describe GraphQL::Schema::RelayClassicMutation do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
describe "execution" do
|
|
40
|
+
after do
|
|
41
|
+
Jazz::Models.reset
|
|
42
|
+
end
|
|
43
|
+
|
|
40
44
|
it "works with no arguments" do
|
|
41
45
|
res = Jazz::Schema.execute <<-GRAPHQL
|
|
42
46
|
mutation {
|
|
@@ -51,6 +55,20 @@ describe GraphQL::Schema::RelayClassicMutation do
|
|
|
51
55
|
assert_equal "Sitar", res["data"]["addSitar"]["instrument"]["name"]
|
|
52
56
|
end
|
|
53
57
|
|
|
58
|
+
it "works with InputObject arguments" do
|
|
59
|
+
res = Jazz::Schema.execute <<-GRAPHQL
|
|
60
|
+
mutation {
|
|
61
|
+
addEnsembleRelay(input: { ensemble: { name: "Miles Davis Quartet" } }) {
|
|
62
|
+
ensemble {
|
|
63
|
+
name
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
GRAPHQL
|
|
68
|
+
|
|
69
|
+
assert_equal "Miles Davis Quartet", res["data"]["addEnsembleRelay"]["ensemble"]["name"]
|
|
70
|
+
end
|
|
71
|
+
|
|
54
72
|
it "supports extras" do
|
|
55
73
|
res = Jazz::Schema.execute <<-GRAPHQL
|
|
56
74
|
mutation {
|
|
@@ -49,6 +49,20 @@ describe GraphQL::Schema::RescueMiddleware do
|
|
|
49
49
|
assert_equal("there was an example error: SecondSpecExampleError", result.message)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
|
+
|
|
53
|
+
describe "with GraphQL::ExecutionError as an argument" do
|
|
54
|
+
let(:rescue_middleware) do
|
|
55
|
+
middleware = GraphQL::Schema::RescueMiddleware.new
|
|
56
|
+
middleware.rescue_from(SpecExampleError) { |err| GraphQL::ExecutionError.new("there was an example error: #{err.class.name}", extensions: { code: "EXAMPLE_ERROR" }) }
|
|
57
|
+
middleware
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "has the extensions key" do
|
|
61
|
+
result = middleware_chain.invoke([])
|
|
62
|
+
assert_equal("there was an example error: SpecExampleError", result.message)
|
|
63
|
+
assert_equal({ code: "EXAMPLE_ERROR" }, result.extensions)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
52
66
|
end
|
|
53
67
|
|
|
54
68
|
describe "unknown errors" do
|
|
@@ -817,7 +817,7 @@ describe GraphQL::Schema::Warden do
|
|
|
817
817
|
res = MaskHelpers.query_with_mask(query_string, mask, variables: { "manners" => ["STOP", "TRILL"] })
|
|
818
818
|
# It's not a good error message ... but it's something!
|
|
819
819
|
expected_errors = [
|
|
820
|
-
"Variable manners of type [Manner!]! was provided invalid value",
|
|
820
|
+
"Variable manners of type [Manner!]! was provided invalid value for 1 (Expected \"TRILL\" to be one of: STOP, AFFRICATE, FRICATIVE, APPROXIMANT, VOWEL)",
|
|
821
821
|
]
|
|
822
822
|
assert_equal expected_errors, error_messages(res)
|
|
823
823
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "spec_helper"
|
|
3
|
+
|
|
4
|
+
describe GraphQL::Types::Relay::BaseEdge do
|
|
5
|
+
module NonNullableDummy
|
|
6
|
+
class NonNullableNode < GraphQL::Schema::Object; end
|
|
7
|
+
|
|
8
|
+
class NonNullableNodeEdgeType < GraphQL::Types::Relay::BaseEdge
|
|
9
|
+
node_type(NonNullableNode, null: false)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class NonNullableNodeEdgeConnectionType < GraphQL::Types::Relay::BaseConnection
|
|
13
|
+
edge_type(NonNullableNodeEdgeType, nodes_field: false)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class Query < GraphQL::Schema::Object
|
|
17
|
+
field :connection, NonNullableNodeEdgeConnectionType, null: false
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class Schema < GraphQL::Schema
|
|
21
|
+
query Query
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "runs the introspection query and the result contains a edge field that has non-nullable node" do
|
|
26
|
+
res = NonNullableDummy::Schema.execute(GraphQL::Introspection::INTROSPECTION_QUERY)
|
|
27
|
+
assert res
|
|
28
|
+
edge_type = res["data"]["__schema"]["types"].find { |t| t["name"] == "NonNullableNodeEdge" }
|
|
29
|
+
node_field = edge_type["fields"].find { |f| f["name"] == "node" }
|
|
30
|
+
assert_equal "NON_NULL", node_field["type"]["kind"]
|
|
31
|
+
assert_equal "NonNullableNode", node_field["type"]["ofType"]["name"]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -3,6 +3,7 @@ require "spec_helper"
|
|
|
3
3
|
|
|
4
4
|
describe GraphQL::Schema do
|
|
5
5
|
let(:schema) { Dummy::Schema }
|
|
6
|
+
let(:admin_schema) { Dummy::AdminSchema }
|
|
6
7
|
let(:relay_schema) { StarWars::Schema }
|
|
7
8
|
let(:empty_schema) { GraphQL::Schema.define }
|
|
8
9
|
|
|
@@ -433,6 +434,18 @@ type Query {
|
|
|
433
434
|
errors = schema.validate("fragment on Cheese { id }", rules: custom_rules)
|
|
434
435
|
assert_equal([], errors)
|
|
435
436
|
end
|
|
437
|
+
|
|
438
|
+
it "accepts a context hash" do
|
|
439
|
+
context = { admin: false }
|
|
440
|
+
# AdminSchema is a barebones dummy schema, where fields are visible only with context[:admin] == true
|
|
441
|
+
errors = admin_schema.validate('query { adminOnlyMessage }', context: context)
|
|
442
|
+
assert_equal 1, errors.length
|
|
443
|
+
assert_equal("Field 'adminOnlyMessage' doesn't exist on type 'AdminDairyAppQuery'", errors.first.message)
|
|
444
|
+
|
|
445
|
+
context = { admin: true }
|
|
446
|
+
errors = admin_schema.validate('query { adminOnlyMessage }', context: context)
|
|
447
|
+
assert_equal([], errors)
|
|
448
|
+
end
|
|
436
449
|
end
|
|
437
450
|
|
|
438
451
|
describe "#as_json / #to_json" do
|
|
@@ -11,6 +11,12 @@ module Dummy
|
|
|
11
11
|
accepts_definition :joins
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
class AdminField < GraphQL::Schema::Field
|
|
15
|
+
def visible?(context)
|
|
16
|
+
context[:admin] == true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
module BaseInterface
|
|
15
21
|
include GraphQL::Schema::Interface
|
|
16
22
|
end
|
|
@@ -427,6 +433,15 @@ module Dummy
|
|
|
427
433
|
def deep_non_null; :deep_non_null; end
|
|
428
434
|
end
|
|
429
435
|
|
|
436
|
+
class AdminDairyAppQuery < BaseObject
|
|
437
|
+
field_class AdminField
|
|
438
|
+
|
|
439
|
+
field :admin_only_message, String, null: true
|
|
440
|
+
def admin_only_message
|
|
441
|
+
"This field is only visible to admin"
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
|
|
430
445
|
GLOBAL_VALUES = []
|
|
431
446
|
|
|
432
447
|
class ReplaceValuesInput < BaseInputObject
|
|
@@ -489,4 +504,8 @@ module Dummy
|
|
|
489
504
|
use GraphQL::Execution::Interpreter
|
|
490
505
|
end
|
|
491
506
|
end
|
|
507
|
+
|
|
508
|
+
class AdminSchema < GraphQL::Schema
|
|
509
|
+
query AdminDairyAppQuery
|
|
510
|
+
end
|
|
492
511
|
end
|
data/spec/support/jazz.rb
CHANGED
|
@@ -249,16 +249,6 @@ module Jazz
|
|
|
249
249
|
end
|
|
250
250
|
end
|
|
251
251
|
|
|
252
|
-
class RawJson < GraphQL::Schema::Scalar
|
|
253
|
-
def self.coerce_input(val, ctx)
|
|
254
|
-
val
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
def self.coerce_result(val, ctx)
|
|
258
|
-
val
|
|
259
|
-
end
|
|
260
|
-
end
|
|
261
|
-
|
|
262
252
|
class Musician < BaseObject
|
|
263
253
|
implements GloballyIdentifiableType
|
|
264
254
|
implements NamedEntity
|
|
@@ -359,12 +349,12 @@ module Jazz
|
|
|
359
349
|
field :inspect_context, [String], null: false
|
|
360
350
|
field :hashyEnsemble, Ensemble, null: false
|
|
361
351
|
|
|
362
|
-
field :echo_json,
|
|
363
|
-
argument :input,
|
|
352
|
+
field :echo_json, GraphQL::Types::JSON, null: false do
|
|
353
|
+
argument :input, GraphQL::Types::JSON, required: true
|
|
364
354
|
end
|
|
365
355
|
|
|
366
|
-
field :echo_first_json,
|
|
367
|
-
argument :input, [
|
|
356
|
+
field :echo_first_json, GraphQL::Types::JSON, null: false do
|
|
357
|
+
argument :input, [GraphQL::Types::JSON], required: true
|
|
368
358
|
end
|
|
369
359
|
|
|
370
360
|
field :upcase_check_1, String, null: true, resolver_method: :upcase_check, extras: [:upcase]
|
|
@@ -503,6 +493,17 @@ module Jazz
|
|
|
503
493
|
end
|
|
504
494
|
end
|
|
505
495
|
|
|
496
|
+
class AddEnsembleRelay < GraphQL::Schema::RelayClassicMutation
|
|
497
|
+
argument :ensemble, EnsembleInput, required: true
|
|
498
|
+
field :ensemble, Ensemble, null: false
|
|
499
|
+
|
|
500
|
+
def resolve(ensemble:)
|
|
501
|
+
ens = Models::Ensemble.new(ensemble.name)
|
|
502
|
+
Models.data["Ensemble"] << ens
|
|
503
|
+
{ ensemble: ens }
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
|
|
506
507
|
class AddSitar < GraphQL::Schema::RelayClassicMutation
|
|
507
508
|
null true
|
|
508
509
|
description "Get Sitar to musical instrument"
|
|
@@ -633,6 +634,7 @@ module Jazz
|
|
|
633
634
|
end
|
|
634
635
|
|
|
635
636
|
field :add_instrument, mutation: AddInstrument
|
|
637
|
+
field :add_ensemble_relay, mutation: AddEnsembleRelay
|
|
636
638
|
field :add_sitar, mutation: AddSitar
|
|
637
639
|
field :rename_ensemble, mutation: RenameEnsemble
|
|
638
640
|
field :rename_named_entity, mutation: RenameNamedEntity
|
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: 1.9.
|
|
4
|
+
version: 1.9.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: benchmark-ips
|
|
@@ -210,16 +210,16 @@ dependencies:
|
|
|
210
210
|
name: rubocop
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
|
-
- -
|
|
213
|
+
- - '='
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: '0.
|
|
215
|
+
version: '0.68'
|
|
216
216
|
type: :development
|
|
217
217
|
prerelease: false
|
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
|
219
219
|
requirements:
|
|
220
|
-
- -
|
|
220
|
+
- - '='
|
|
221
221
|
- !ruby/object:Gem::Version
|
|
222
|
-
version: '0.
|
|
222
|
+
version: '0.68'
|
|
223
223
|
- !ruby/object:Gem::Dependency
|
|
224
224
|
name: appraisal
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -679,6 +679,7 @@ files:
|
|
|
679
679
|
- lib/graphql/types/id.rb
|
|
680
680
|
- lib/graphql/types/int.rb
|
|
681
681
|
- lib/graphql/types/iso_8601_date_time.rb
|
|
682
|
+
- lib/graphql/types/json.rb
|
|
682
683
|
- lib/graphql/types/relay.rb
|
|
683
684
|
- lib/graphql/types/relay/base_connection.rb
|
|
684
685
|
- lib/graphql/types/relay/base_edge.rb
|
|
@@ -699,6 +700,7 @@ files:
|
|
|
699
700
|
- lib/graphql/version.rb
|
|
700
701
|
- readme.md
|
|
701
702
|
- spec/dummy/Gemfile
|
|
703
|
+
- spec/dummy/Gemfile.lock
|
|
702
704
|
- spec/dummy/README.md
|
|
703
705
|
- spec/dummy/Rakefile
|
|
704
706
|
- spec/dummy/app/assets/config/manifest.js
|
|
@@ -737,6 +739,7 @@ files:
|
|
|
737
739
|
- spec/dummy/config/puma.rb
|
|
738
740
|
- spec/dummy/config/routes.rb
|
|
739
741
|
- spec/dummy/config/secrets.yml
|
|
742
|
+
- spec/dummy/log/test.log
|
|
740
743
|
- spec/dummy/package.json
|
|
741
744
|
- spec/dummy/public/404.html
|
|
742
745
|
- spec/dummy/public/422.html
|
|
@@ -748,6 +751,26 @@ files:
|
|
|
748
751
|
- spec/dummy/test/application_system_test_case.rb
|
|
749
752
|
- spec/dummy/test/system/action_cable_subscription_test.rb
|
|
750
753
|
- spec/dummy/test/test_helper.rb
|
|
754
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/4w/4wzXRZrAkwKdgYaSE0pid5eB-fer8vSfSku_NPg4rMA.cache
|
|
755
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/7I/7IHVBiJT06QSpgLpLoJIxboQ0B-D_tMTxsvoezBTV3Q.cache
|
|
756
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache
|
|
757
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/AK/AKzz1u6bGb4auXcrObA_g5LL-oV0ejNGa448AgAi_WQ.cache
|
|
758
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/ET/ETW4uxvaYpruL8y6_ZptUH82ZowMaHIqvg5WexBFdEM.cache
|
|
759
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/F1/F1TWpjjyA56k9Z90n5B3xRn7DUdGjX73QCkYC6k07JQ.cache
|
|
760
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8MUNRzORGFgr329fNM0xLaoWCXdv3BIalT7dsvLfjs.cache
|
|
761
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/KB/KB07ZaKNC5uXJ7TjLi-WqnY6g7dq8wWp_8N3HNjBNxg.cache
|
|
762
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/Ms/MsKSimH_UCB-H1tLvDABDHuvGciuoW6kVqQWDrXU5FQ.cache
|
|
763
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/Mt/Mtci-Kim50aPOmeClD4AIicKn1d1WJ0n454IjSd94sk.cache
|
|
764
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/QH/QHt3Tc1Y6M66Oo_pDuMyWrQNs4Pp3SMeZR5K1wJj2Ts.cache
|
|
765
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/XU/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache
|
|
766
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/ZI/ZIof7mZxWWCnraIFOCuV6a8QRWzKJXJnx2Xd7C0ZyX0.cache
|
|
767
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/cG/cGc_puuPS5pZKgUcy1Y_i1L6jl5UtsiIrMH59rTzR6c.cache
|
|
768
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/df/dfro_B6bx3KP1Go-7jEOqqZ2j4hVRseXIc3es9PKQno.cache
|
|
769
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/jO/jO1DfbqnG0mTULsjJJANc3fefrG2zt7DIMmcptMT628.cache
|
|
770
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache
|
|
771
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/r9/r9iU1l58a6rxkZSW5RSC52_tD-_UQuHxoMVnkfJ7Mhs.cache
|
|
772
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/xi/xitPPFfPIyDMpaznV0sBBcw8eSCV8PJcLLWin78sCgE.cache
|
|
773
|
+
- spec/dummy/tmp/screenshots/failures_test_it_handles_subscriptions.png
|
|
751
774
|
- spec/fixtures/upgrader/account.original.rb
|
|
752
775
|
- spec/fixtures/upgrader/account.transformed.rb
|
|
753
776
|
- spec/fixtures/upgrader/blame_range.original.rb
|
|
@@ -918,6 +941,7 @@ files:
|
|
|
918
941
|
- spec/graphql/tracing_spec.rb
|
|
919
942
|
- spec/graphql/types/big_int_spec.rb
|
|
920
943
|
- spec/graphql/types/iso_8601_date_time_spec.rb
|
|
944
|
+
- spec/graphql/types/relay/base_edge_spec.rb
|
|
921
945
|
- spec/graphql/union_type_spec.rb
|
|
922
946
|
- spec/graphql/upgrader/member_spec.rb
|
|
923
947
|
- spec/graphql/upgrader/schema_spec.rb
|
|
@@ -951,6 +975,7 @@ files:
|
|
|
951
975
|
- spec/integration/rails/graphql/schema_spec.rb
|
|
952
976
|
- spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
|
|
953
977
|
- spec/integration/rails/spec_helper.rb
|
|
978
|
+
- spec/integration/tmp/app/graphql/types/bird_type.rb
|
|
954
979
|
- spec/spec_helper.rb
|
|
955
980
|
- spec/support/dummy/data.rb
|
|
956
981
|
- spec/support/dummy/schema.rb
|
|
@@ -991,7 +1016,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
991
1016
|
- !ruby/object:Gem::Version
|
|
992
1017
|
version: '0'
|
|
993
1018
|
requirements: []
|
|
994
|
-
|
|
1019
|
+
rubyforge_project:
|
|
1020
|
+
rubygems_version: 2.6.13
|
|
995
1021
|
signing_key:
|
|
996
1022
|
specification_version: 4
|
|
997
1023
|
summary: A GraphQL language and runtime for Ruby
|
|
@@ -1047,10 +1073,33 @@ test_files:
|
|
|
1047
1073
|
- spec/dummy/public/robots.txt
|
|
1048
1074
|
- spec/dummy/package.json
|
|
1049
1075
|
- spec/dummy/Gemfile
|
|
1076
|
+
- spec/dummy/log/test.log
|
|
1077
|
+
- spec/dummy/Gemfile.lock
|
|
1078
|
+
- spec/dummy/tmp/screenshots/failures_test_it_handles_subscriptions.png
|
|
1079
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache
|
|
1080
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/Ms/MsKSimH_UCB-H1tLvDABDHuvGciuoW6kVqQWDrXU5FQ.cache
|
|
1081
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/Mt/Mtci-Kim50aPOmeClD4AIicKn1d1WJ0n454IjSd94sk.cache
|
|
1082
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/KB/KB07ZaKNC5uXJ7TjLi-WqnY6g7dq8wWp_8N3HNjBNxg.cache
|
|
1083
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/df/dfro_B6bx3KP1Go-7jEOqqZ2j4hVRseXIc3es9PKQno.cache
|
|
1084
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/AK/AKzz1u6bGb4auXcrObA_g5LL-oV0ejNGa448AgAi_WQ.cache
|
|
1085
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/cG/cGc_puuPS5pZKgUcy1Y_i1L6jl5UtsiIrMH59rTzR6c.cache
|
|
1086
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/jO/jO1DfbqnG0mTULsjJJANc3fefrG2zt7DIMmcptMT628.cache
|
|
1087
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/xi/xitPPFfPIyDMpaznV0sBBcw8eSCV8PJcLLWin78sCgE.cache
|
|
1088
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/r9/r9iU1l58a6rxkZSW5RSC52_tD-_UQuHxoMVnkfJ7Mhs.cache
|
|
1089
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/XU/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache
|
|
1090
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/QH/QHt3Tc1Y6M66Oo_pDuMyWrQNs4Pp3SMeZR5K1wJj2Ts.cache
|
|
1091
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/4w/4wzXRZrAkwKdgYaSE0pid5eB-fer8vSfSku_NPg4rMA.cache
|
|
1092
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/ZI/ZIof7mZxWWCnraIFOCuV6a8QRWzKJXJnx2Xd7C0ZyX0.cache
|
|
1093
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/ET/ETW4uxvaYpruL8y6_ZptUH82ZowMaHIqvg5WexBFdEM.cache
|
|
1094
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/F1/F1TWpjjyA56k9Z90n5B3xRn7DUdGjX73QCkYC6k07JQ.cache
|
|
1095
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8MUNRzORGFgr329fNM0xLaoWCXdv3BIalT7dsvLfjs.cache
|
|
1096
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/7I/7IHVBiJT06QSpgLpLoJIxboQ0B-D_tMTxsvoezBTV3Q.cache
|
|
1097
|
+
- spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache
|
|
1050
1098
|
- spec/integration/mongoid/spec_helper.rb
|
|
1051
1099
|
- spec/integration/mongoid/star_trek/schema.rb
|
|
1052
1100
|
- spec/integration/mongoid/star_trek/data.rb
|
|
1053
1101
|
- spec/integration/mongoid/graphql/relay/mongo_relation_connection_spec.rb
|
|
1102
|
+
- spec/integration/tmp/app/graphql/types/bird_type.rb
|
|
1054
1103
|
- spec/integration/rails/spec_helper.rb
|
|
1055
1104
|
- spec/integration/rails/data.rb
|
|
1056
1105
|
- spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
|
|
@@ -1107,6 +1156,7 @@ test_files:
|
|
|
1107
1156
|
- spec/graphql/int_type_spec.rb
|
|
1108
1157
|
- spec/graphql/types/iso_8601_date_time_spec.rb
|
|
1109
1158
|
- spec/graphql/types/big_int_spec.rb
|
|
1159
|
+
- spec/graphql/types/relay/base_edge_spec.rb
|
|
1110
1160
|
- spec/graphql/field_spec.rb
|
|
1111
1161
|
- spec/graphql/analysis/max_query_depth_spec.rb
|
|
1112
1162
|
- spec/graphql/analysis/max_query_complexity_spec.rb
|