graphql 1.4.5 → 1.5.3
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/enum_generator.rb +33 -0
- data/lib/generators/graphql/function_generator.rb +15 -0
- data/lib/generators/graphql/install_generator.rb +118 -0
- data/lib/generators/graphql/interface_generator.rb +27 -0
- data/lib/generators/graphql/loader_generator.rb +17 -0
- data/lib/generators/graphql/mutation_generator.rb +19 -0
- data/lib/generators/graphql/object_generator.rb +34 -0
- data/lib/generators/graphql/templates/enum.erb +4 -0
- data/lib/generators/graphql/templates/function.erb +17 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +32 -0
- data/lib/generators/graphql/templates/interface.erb +4 -0
- data/lib/generators/graphql/templates/loader.erb +15 -0
- data/lib/generators/graphql/templates/mutation.erb +12 -0
- data/lib/generators/graphql/templates/object.erb +5 -0
- data/lib/generators/graphql/templates/query_type.erb +15 -0
- data/lib/generators/graphql/templates/schema.erb +34 -0
- data/lib/generators/graphql/templates/union.erb +4 -0
- data/lib/generators/graphql/type_generator.rb +78 -0
- data/lib/generators/graphql/union_generator.rb +33 -0
- data/lib/graphql.rb +10 -0
- data/lib/graphql/analysis/analyze_query.rb +1 -1
- data/lib/graphql/analysis/query_complexity.rb +6 -50
- data/lib/graphql/analysis/query_depth.rb +1 -1
- data/lib/graphql/argument.rb +21 -0
- data/lib/graphql/compatibility/execution_specification/counter_schema.rb +3 -3
- data/lib/graphql/define.rb +1 -0
- data/lib/graphql/define/assign_argument.rb +3 -19
- data/lib/graphql/define/assign_mutation_function.rb +34 -0
- data/lib/graphql/define/assign_object_field.rb +26 -14
- data/lib/graphql/define/defined_object_proxy.rb +21 -0
- data/lib/graphql/define/instance_definable.rb +61 -11
- data/lib/graphql/directive.rb +6 -1
- data/lib/graphql/execution/directive_checks.rb +1 -0
- data/lib/graphql/execution/execute.rb +14 -9
- data/lib/graphql/execution/field_result.rb +1 -0
- data/lib/graphql/execution/lazy.rb +8 -17
- data/lib/graphql/execution/lazy/lazy_method_map.rb +2 -0
- data/lib/graphql/execution/lazy/resolve.rb +1 -0
- data/lib/graphql/execution/selection_result.rb +1 -0
- data/lib/graphql/execution/typecast.rb +39 -26
- data/lib/graphql/field.rb +15 -3
- data/lib/graphql/field/resolve.rb +3 -3
- data/lib/graphql/function.rb +134 -0
- data/lib/graphql/id_type.rb +1 -1
- data/lib/graphql/input_object_type.rb +1 -1
- data/lib/graphql/internal_representation.rb +1 -1
- data/lib/graphql/internal_representation/node.rb +35 -107
- data/lib/graphql/internal_representation/rewrite.rb +189 -183
- data/lib/graphql/internal_representation/visit.rb +38 -0
- data/lib/graphql/introspection/input_value_type.rb +10 -1
- data/lib/graphql/introspection/schema_type.rb +1 -1
- data/lib/graphql/language/lexer.rb +6 -3
- data/lib/graphql/language/lexer.rl +6 -3
- data/lib/graphql/object_type.rb +53 -13
- data/lib/graphql/query.rb +30 -14
- data/lib/graphql/query/arguments.rb +2 -0
- data/lib/graphql/query/context.rb +2 -2
- data/lib/graphql/query/literal_input.rb +9 -0
- data/lib/graphql/query/serial_execution/field_resolution.rb +2 -2
- data/lib/graphql/query/serial_execution/selection_resolution.rb +1 -1
- data/lib/graphql/relay.rb +1 -0
- data/lib/graphql/relay/array_connection.rb +1 -1
- data/lib/graphql/relay/base_connection.rb +34 -15
- data/lib/graphql/relay/connection_resolve.rb +7 -2
- data/lib/graphql/relay/mutation.rb +45 -4
- data/lib/graphql/relay/node.rb +18 -6
- data/lib/graphql/relay/range_add.rb +45 -0
- data/lib/graphql/relay/relation_connection.rb +17 -2
- data/lib/graphql/runtime_type_error.rb +1 -0
- data/lib/graphql/schema.rb +40 -5
- data/lib/graphql/schema/base_64_encoder.rb +1 -0
- data/lib/graphql/schema/build_from_definition.rb +56 -21
- data/lib/graphql/schema/default_parse_error.rb +10 -0
- data/lib/graphql/schema/loader.rb +8 -1
- data/lib/graphql/schema/null_mask.rb +1 -0
- data/lib/graphql/schema/validation.rb +35 -0
- data/lib/graphql/static_validation.rb +1 -0
- data/lib/graphql/static_validation/all_rules.rb +1 -0
- data/lib/graphql/static_validation/arguments_validator.rb +7 -4
- data/lib/graphql/static_validation/definition_dependencies.rb +183 -0
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +28 -96
- data/lib/graphql/static_validation/rules/fragment_names_are_unique.rb +23 -0
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +8 -5
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +6 -31
- data/lib/graphql/static_validation/rules/fragments_are_used.rb +11 -41
- data/lib/graphql/static_validation/rules/operation_names_are_valid.rb +2 -2
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +19 -7
- data/lib/graphql/static_validation/validation_context.rb +22 -1
- data/lib/graphql/static_validation/validator.rb +4 -1
- data/lib/graphql/string_type.rb +5 -1
- data/lib/graphql/version.rb +1 -1
- data/readme.md +12 -3
- data/spec/generators/graphql/enum_generator_spec.rb +29 -0
- data/spec/generators/graphql/function_generator_spec.rb +33 -0
- data/spec/generators/graphql/install_generator_spec.rb +185 -0
- data/spec/generators/graphql/interface_generator_spec.rb +32 -0
- data/spec/generators/graphql/loader_generator_spec.rb +31 -0
- data/spec/generators/graphql/mutation_generator_spec.rb +28 -0
- data/spec/generators/graphql/object_generator_spec.rb +42 -0
- data/spec/generators/graphql/union_generator_spec.rb +50 -0
- data/spec/graphql/analysis/query_complexity_spec.rb +2 -1
- data/spec/graphql/define/instance_definable_spec.rb +38 -0
- data/spec/graphql/directive/skip_directive_spec.rb +1 -0
- data/spec/graphql/directive_spec.rb +18 -0
- data/spec/graphql/execution/typecast_spec.rb +41 -46
- data/spec/graphql/field_spec.rb +1 -1
- data/spec/graphql/function_spec.rb +128 -0
- data/spec/graphql/internal_representation/rewrite_spec.rb +166 -129
- data/spec/graphql/introspection/type_type_spec.rb +1 -1
- data/spec/graphql/language/lexer_spec.rb +6 -0
- data/spec/graphql/object_type_spec.rb +73 -2
- data/spec/graphql/query/arguments_spec.rb +28 -0
- data/spec/graphql/query/variables_spec.rb +7 -1
- data/spec/graphql/query_spec.rb +30 -0
- data/spec/graphql/relay/base_connection_spec.rb +26 -8
- data/spec/graphql/relay/connection_resolve_spec.rb +45 -0
- data/spec/graphql/relay/connection_type_spec.rb +21 -0
- data/spec/graphql/relay/node_spec.rb +30 -2
- data/spec/graphql/relay/range_add_spec.rb +113 -0
- data/spec/graphql/schema/build_from_definition_spec.rb +114 -0
- data/spec/graphql/schema/loader_spec.rb +1 -0
- data/spec/graphql/schema/printer_spec.rb +2 -2
- data/spec/graphql/schema/validation_spec.rb +80 -11
- data/spec/graphql/schema/warden_spec.rb +10 -10
- data/spec/graphql/schema_spec.rb +18 -1
- data/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +16 -0
- data/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +50 -3
- data/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb +27 -0
- data/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb +57 -0
- data/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +1 -1
- data/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +14 -0
- data/spec/graphql/string_type_spec.rb +7 -0
- data/spec/spec_helper.rb +3 -3
- data/spec/support/base_generator_test.rb +7 -0
- data/spec/support/dummy/schema.rb +32 -30
- data/spec/support/star_wars/schema.rb +81 -23
- metadata +98 -20
- data/lib/graphql/internal_representation/selection.rb +0 -85
@@ -17,7 +17,7 @@ describe GraphQL::StaticValidation::FragmentsAreUsed do
|
|
17
17
|
assert_includes(errors, {
|
18
18
|
"message"=>"Fragment unusedFields was defined, but not used",
|
19
19
|
"locations"=>[{"line"=>8, "column"=>5}],
|
20
|
-
"fields"=>[],
|
20
|
+
"fields"=>["fragment unusedFields"],
|
21
21
|
})
|
22
22
|
end
|
23
23
|
|
@@ -43,4 +43,18 @@ describe GraphQL::StaticValidation::VariablesAreInputTypes do
|
|
43
43
|
"fields"=>["query getCheese"],
|
44
44
|
})
|
45
45
|
end
|
46
|
+
|
47
|
+
describe "typos" do
|
48
|
+
it "returns a client error" do
|
49
|
+
res = schema.execute <<-GRAPHQL
|
50
|
+
query GetCheese($id: IDX) {
|
51
|
+
cheese(id: $id) { flavor }
|
52
|
+
}
|
53
|
+
GRAPHQL
|
54
|
+
|
55
|
+
assert_equal false, res.key?("data")
|
56
|
+
assert_equal 1, res["errors"].length
|
57
|
+
assert_equal "IDX isn't a defined input type (on $id)", res["errors"][0]["message"]
|
58
|
+
end
|
59
|
+
end
|
46
60
|
end
|
@@ -8,6 +8,13 @@ describe GraphQL::STRING_TYPE do
|
|
8
8
|
assert_equal(true, string_type.default_scalar?)
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "coerce_result" do
|
12
|
+
it "requires string to be encoded as UTF-8" do
|
13
|
+
binary_str = "\0\0\0foo\255\255\255".dup.force_encoding("BINARY")
|
14
|
+
assert_equal nil, string_type.coerce_result(binary_str)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
describe "coerce_input" do
|
12
19
|
it "accepts strings" do
|
13
20
|
assert_equal "str", string_type.coerce_input("str")
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "codeclimate-test-reporter"
|
3
3
|
CodeClimate::TestReporter.start
|
4
|
+
require "rails/all"
|
5
|
+
require "rails/generators"
|
4
6
|
require "sqlite3"
|
5
|
-
require "active_record"
|
6
|
-
require "action_controller"
|
7
7
|
require "sequel"
|
8
8
|
require "graphql"
|
9
9
|
require "benchmark"
|
@@ -20,7 +20,7 @@ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
|
20
20
|
|
21
21
|
|
22
22
|
# This is for convenient access to metadata in test definitions
|
23
|
-
assign_metadata_key = ->
|
23
|
+
assign_metadata_key = ->(target, key, value) { target.metadata[key] = value }
|
24
24
|
GraphQL::BaseType.accepts_definitions(metadata: assign_metadata_key)
|
25
25
|
GraphQL::Field.accepts_definitions(metadata: assign_metadata_key)
|
26
26
|
GraphQL::Argument.accepts_definitions(metadata: assign_metadata_key)
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "graphql"
|
3
|
+
require_relative "./data"
|
2
4
|
module Dummy
|
3
5
|
class NoSuchDairyError < StandardError; end
|
4
6
|
|
@@ -22,7 +24,7 @@ module Dummy
|
|
22
24
|
AnimalProductInterface = GraphQL::InterfaceType.define do
|
23
25
|
name "AnimalProduct"
|
24
26
|
description "Comes from an animal, no joke"
|
25
|
-
field :source, !
|
27
|
+
field :source, !DairyAnimalEnum, "Animal which produced this product"
|
26
28
|
end
|
27
29
|
|
28
30
|
BeverageUnion = GraphQL::UnionType.define do
|
@@ -96,7 +98,7 @@ module Dummy
|
|
96
98
|
description "Dairy beverage"
|
97
99
|
interfaces [EdibleInterface, AnimalProductInterface, LocalProductInterface]
|
98
100
|
field :id, !types.ID
|
99
|
-
field :source, DairyAnimalEnum, "Animal which produced this milk", hash_key: :source
|
101
|
+
field :source, !DairyAnimalEnum, "Animal which produced this milk", hash_key: :source
|
100
102
|
field :origin, !types.String, "Place the milk comes from"
|
101
103
|
field :flavors, types[types.String], "Chocolate, Strawberry, etc" do
|
102
104
|
argument :limit, types.Int
|
@@ -200,34 +202,34 @@ module Dummy
|
|
200
202
|
end
|
201
203
|
end
|
202
204
|
|
203
|
-
class
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
end
|
205
|
+
class FetchItem < GraphQL::Function
|
206
|
+
attr_reader :type, :description, :arguments
|
207
|
+
|
208
|
+
def initialize(type:, data:, id_type: !GraphQL::INT_TYPE)
|
209
|
+
@type = type
|
210
|
+
@data = data
|
211
|
+
@description = "Find a #{type.name} by id"
|
212
|
+
@arguments = self.class.arguments.merge({"id" => GraphQL::Argument.define(name: "id", type: id_type)})
|
213
|
+
end
|
214
|
+
|
215
|
+
def call(obj, args, ctx)
|
216
|
+
id_string = args["id"].to_s # Cheese has Int type, Milk has ID type :(
|
217
|
+
id, item = @data.find { |id, item| id.to_s == id_string }
|
218
|
+
item
|
218
219
|
end
|
219
220
|
end
|
220
221
|
|
221
|
-
class
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
222
|
+
class GetSingleton < GraphQL::Function
|
223
|
+
attr_reader :description, :type
|
224
|
+
|
225
|
+
def initialize(type:, data:)
|
226
|
+
@description = "Find the only #{type.name}"
|
227
|
+
@type = type
|
228
|
+
@data = data
|
229
|
+
end
|
228
230
|
|
229
|
-
|
230
|
-
|
231
|
+
def call(obj, args, ctx)
|
232
|
+
@data
|
231
233
|
end
|
232
234
|
end
|
233
235
|
|
@@ -253,12 +255,12 @@ module Dummy
|
|
253
255
|
field :root, types.String do
|
254
256
|
resolve ->(root_value, args, c) { root_value }
|
255
257
|
end
|
256
|
-
field :cheese,
|
257
|
-
field :milk,
|
258
|
-
field :dairy,
|
258
|
+
field :cheese, function: FetchItem.new(type: CheeseType, data: CHEESES)
|
259
|
+
field :milk, function: FetchItem.new(type: MilkType, data: MILKS, id_type: !types.ID)
|
260
|
+
field :dairy, function: GetSingleton.new(type: DairyType, data: DAIRY)
|
259
261
|
field :fromSource, &SourceFieldDefn
|
260
262
|
field :favoriteEdible, FavoriteFieldDefn
|
261
|
-
field :cow,
|
263
|
+
field :cow, function: GetSingleton.new(type: CowType, data: COW)
|
262
264
|
field :searchDairy do
|
263
265
|
description "Find dairy products matching a description"
|
264
266
|
type !DairyProductUnion
|
@@ -16,7 +16,17 @@ module StarWars
|
|
16
16
|
name "Base"
|
17
17
|
interfaces [GraphQL::Relay::Node.interface]
|
18
18
|
global_id_field :id
|
19
|
-
field :name, types.String
|
19
|
+
field :name, !types.String do
|
20
|
+
resolve ->(obj, args, ctx) {
|
21
|
+
LazyWrapper.new {
|
22
|
+
if obj.id.nil?
|
23
|
+
raise GraphQL::ExecutionError, "Boom!"
|
24
|
+
else
|
25
|
+
obj.name
|
26
|
+
end
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
20
30
|
field :planet, types.String
|
21
31
|
end
|
22
32
|
|
@@ -59,6 +69,20 @@ module StarWars
|
|
59
69
|
field :fieldName, types.String, resolve: ->(obj, args, ctx) { obj.field.name }
|
60
70
|
end
|
61
71
|
|
72
|
+
# Example of GraphQL::Function used with the connection helper:
|
73
|
+
class ShipsWithMaxPageSize < GraphQL::Function
|
74
|
+
argument :nameIncludes, GraphQL::STRING_TYPE
|
75
|
+
def call(obj, args, ctx)
|
76
|
+
all_ships = obj.ships.map { |ship_id| StarWars::DATA["Ship"][ship_id] }
|
77
|
+
if args[:nameIncludes]
|
78
|
+
all_ships = all_ships.select { |ship| ship.name.include?(args[:nameIncludes])}
|
79
|
+
end
|
80
|
+
all_ships
|
81
|
+
end
|
82
|
+
|
83
|
+
type Ship.connection_type
|
84
|
+
end
|
85
|
+
|
62
86
|
Faction = GraphQL::ObjectType.define do
|
63
87
|
name "Faction"
|
64
88
|
interfaces [GraphQL::Relay::Node.interface]
|
@@ -69,18 +93,18 @@ module StarWars
|
|
69
93
|
resolve ->(obj, args, ctx) {
|
70
94
|
all_ships = obj.ships.map {|ship_id| StarWars::DATA["Ship"][ship_id] }
|
71
95
|
if args[:nameIncludes]
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
96
|
+
case args[:nameIncludes]
|
97
|
+
when "error"
|
98
|
+
all_ships = GraphQL::ExecutionError.new("error from within connection")
|
99
|
+
when "raisedError"
|
100
|
+
raise GraphQL::ExecutionError.new("error raised from within connection")
|
101
|
+
when "lazyError"
|
102
|
+
all_ships = LazyWrapper.new { GraphQL::ExecutionError.new("lazy error from within connection") }
|
103
|
+
when "lazyRaisedError"
|
104
|
+
all_ships = LazyWrapper.new { raise GraphQL::ExecutionError.new("lazy raised error from within connection") }
|
105
|
+
else
|
106
|
+
all_ships = all_ships.select { |ship| ship.name.include?(args[:nameIncludes])}
|
107
|
+
end
|
84
108
|
end
|
85
109
|
all_ships
|
86
110
|
}
|
@@ -88,6 +112,8 @@ module StarWars
|
|
88
112
|
argument :nameIncludes, types.String
|
89
113
|
end
|
90
114
|
|
115
|
+
connection :shipsWithMaxPageSize, max_page_size: 2, function: ShipsWithMaxPageSize.new
|
116
|
+
|
91
117
|
connection :bases, BaseConnectionWithTotalCountType do
|
92
118
|
# Resolve field should return an Array, the Connection
|
93
119
|
# will do the rest!
|
@@ -160,30 +186,52 @@ module StarWars
|
|
160
186
|
|
161
187
|
# Here's the mutation operation:
|
162
188
|
resolve ->(root_obj, inputs, ctx) {
|
163
|
-
|
164
|
-
|
189
|
+
IntroduceShipFunction.new.call(root_obj, inputs, ctx)
|
190
|
+
}
|
191
|
+
end
|
192
|
+
|
193
|
+
class IntroduceShipFunction < GraphQL::Function
|
194
|
+
description "Add a ship to this faction"
|
195
|
+
|
196
|
+
argument :shipName, GraphQL::STRING_TYPE
|
197
|
+
argument :factionId, !GraphQL::ID_TYPE
|
198
|
+
|
199
|
+
type(GraphQL::ObjectType.define do
|
200
|
+
name "IntroduceShipFunctionPayload"
|
201
|
+
field :shipEdge, Ship.edge_type, hash_key: :shipEdge
|
202
|
+
field :faction, Faction, hash_key: :shipEdge
|
203
|
+
end)
|
204
|
+
|
205
|
+
def call(obj, args, ctx)
|
206
|
+
faction_id = args["factionId"]
|
207
|
+
if args["shipName"] == 'Millennium Falcon'
|
165
208
|
GraphQL::ExecutionError.new("Sorry, Millennium Falcon ship is reserved")
|
166
|
-
elsif
|
209
|
+
elsif args["shipName"] == "Ebon Hawk"
|
167
210
|
LazyWrapper.new { raise GraphQL::ExecutionError.new("💥")}
|
168
211
|
else
|
169
|
-
ship = DATA.create_ship(
|
212
|
+
ship = DATA.create_ship(args["shipName"], faction_id)
|
170
213
|
faction = DATA["Faction"][faction_id]
|
171
214
|
connection_class = GraphQL::Relay::BaseConnection.connection_for_nodes(faction.ships)
|
172
|
-
ships_connection = connection_class.new(faction.ships,
|
215
|
+
ships_connection = connection_class.new(faction.ships, args)
|
173
216
|
ship_edge = GraphQL::Relay::Edge.new(ship, ships_connection)
|
174
217
|
result = {
|
175
218
|
shipEdge: ship_edge,
|
176
219
|
faction: faction
|
177
220
|
}
|
178
|
-
if
|
221
|
+
if args["shipName"] == "Slave II"
|
179
222
|
LazyWrapper.new(result)
|
180
223
|
else
|
181
224
|
result
|
182
225
|
end
|
183
226
|
end
|
184
|
-
|
227
|
+
end
|
185
228
|
end
|
186
229
|
|
230
|
+
IntroduceShipFunctionMutation = GraphQL::Relay::Mutation.define do
|
231
|
+
# Used as the root for derived types:
|
232
|
+
name "IntroduceShipFunction"
|
233
|
+
function IntroduceShipFunction.new
|
234
|
+
end
|
187
235
|
|
188
236
|
class LazyWrapper
|
189
237
|
def initialize(value = nil, &block)
|
@@ -219,10 +267,19 @@ module StarWars
|
|
219
267
|
}
|
220
268
|
end
|
221
269
|
|
270
|
+
connection :basesWithNullName, BaseType.connection_type do
|
271
|
+
resolve ->(obj, args, ctx) {
|
272
|
+
[OpenStruct.new(id: nil)]
|
273
|
+
}
|
274
|
+
end
|
275
|
+
|
222
276
|
field :node, GraphQL::Relay::Node.field
|
223
|
-
|
224
|
-
|
225
|
-
|
277
|
+
|
278
|
+
custom_node_field = GraphQL::Relay::Node.field do
|
279
|
+
resolve ->(_, _, _) { StarWars::DATA["Faction"]["1"] }
|
280
|
+
end
|
281
|
+
field :nodeWithCustomResolver, custom_node_field
|
282
|
+
|
226
283
|
field :nodes, GraphQL::Relay::Node.plural_field
|
227
284
|
field :nodesWithCustomResolver, GraphQL::Relay::Node.plural_field(
|
228
285
|
resolve: ->(_, _, _) { [StarWars::DATA["Faction"]["1"], StarWars::DATA["Faction"]["2"]] }
|
@@ -233,6 +290,7 @@ module StarWars
|
|
233
290
|
name "Mutation"
|
234
291
|
# The mutation object exposes a field:
|
235
292
|
field :introduceShip, field: IntroduceShipMutation.field
|
293
|
+
field :introduceShipFunction, IntroduceShipFunctionMutation.field
|
236
294
|
end
|
237
295
|
|
238
296
|
Schema = GraphQL::Schema.define do
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: benchmark-ips
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: codeclimate-test-reporter
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: listen
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,49 +179,49 @@ dependencies:
|
|
151
179
|
- !ruby/object:Gem::Version
|
152
180
|
version: '1.4'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
182
|
+
name: rails
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
156
184
|
requirements:
|
157
|
-
- - "
|
185
|
+
- - ">="
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
187
|
+
version: '0'
|
160
188
|
type: :development
|
161
189
|
prerelease: false
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
163
191
|
requirements:
|
164
|
-
- - "
|
192
|
+
- - ">="
|
165
193
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
194
|
+
version: '0'
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
196
|
+
name: rake
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
170
198
|
requirements:
|
171
199
|
- - "~>"
|
172
200
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
201
|
+
version: '11'
|
174
202
|
type: :development
|
175
203
|
prerelease: false
|
176
204
|
version_requirements: !ruby/object:Gem::Requirement
|
177
205
|
requirements:
|
178
206
|
- - "~>"
|
179
207
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
208
|
+
version: '11'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
210
|
+
name: rubocop
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
184
212
|
requirements:
|
185
|
-
- - "
|
213
|
+
- - "~>"
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
215
|
+
version: '0.45'
|
188
216
|
type: :development
|
189
217
|
prerelease: false
|
190
218
|
version_requirements: !ruby/object:Gem::Requirement
|
191
219
|
requirements:
|
192
|
-
- - "
|
220
|
+
- - "~>"
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
222
|
+
version: '0.45'
|
195
223
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
224
|
+
name: ruby-prof
|
197
225
|
requirement: !ruby/object:Gem::Requirement
|
198
226
|
requirements:
|
199
227
|
- - ">="
|
@@ -262,8 +290,7 @@ dependencies:
|
|
262
290
|
- - ">="
|
263
291
|
- !ruby/object:Gem::Version
|
264
292
|
version: '0'
|
265
|
-
description: A
|
266
|
-
query parsing, static validation, type definition, and query execution.
|
293
|
+
description: A plain-Ruby implementation of GraphQL.
|
267
294
|
email:
|
268
295
|
- rdmosolgo@gmail.com
|
269
296
|
executables: []
|
@@ -272,6 +299,25 @@ extra_rdoc_files: []
|
|
272
299
|
files:
|
273
300
|
- ".yardopts"
|
274
301
|
- MIT-LICENSE
|
302
|
+
- lib/generators/graphql/enum_generator.rb
|
303
|
+
- lib/generators/graphql/function_generator.rb
|
304
|
+
- lib/generators/graphql/install_generator.rb
|
305
|
+
- lib/generators/graphql/interface_generator.rb
|
306
|
+
- lib/generators/graphql/loader_generator.rb
|
307
|
+
- lib/generators/graphql/mutation_generator.rb
|
308
|
+
- lib/generators/graphql/object_generator.rb
|
309
|
+
- lib/generators/graphql/templates/enum.erb
|
310
|
+
- lib/generators/graphql/templates/function.erb
|
311
|
+
- lib/generators/graphql/templates/graphql_controller.erb
|
312
|
+
- lib/generators/graphql/templates/interface.erb
|
313
|
+
- lib/generators/graphql/templates/loader.erb
|
314
|
+
- lib/generators/graphql/templates/mutation.erb
|
315
|
+
- lib/generators/graphql/templates/object.erb
|
316
|
+
- lib/generators/graphql/templates/query_type.erb
|
317
|
+
- lib/generators/graphql/templates/schema.erb
|
318
|
+
- lib/generators/graphql/templates/union.erb
|
319
|
+
- lib/generators/graphql/type_generator.rb
|
320
|
+
- lib/generators/graphql/union_generator.rb
|
275
321
|
- lib/graphql.rb
|
276
322
|
- lib/graphql/analysis.rb
|
277
323
|
- lib/graphql/analysis/analyze_query.rb
|
@@ -300,6 +346,7 @@ files:
|
|
300
346
|
- lib/graphql/define/assign_connection.rb
|
301
347
|
- lib/graphql/define/assign_enum_value.rb
|
302
348
|
- lib/graphql/define/assign_global_id_field.rb
|
349
|
+
- lib/graphql/define/assign_mutation_function.rb
|
303
350
|
- lib/graphql/define/assign_object_field.rb
|
304
351
|
- lib/graphql/define/defined_object_proxy.rb
|
305
352
|
- lib/graphql/define/instance_definable.rb
|
@@ -323,6 +370,7 @@ files:
|
|
323
370
|
- lib/graphql/field.rb
|
324
371
|
- lib/graphql/field/resolve.rb
|
325
372
|
- lib/graphql/float_type.rb
|
373
|
+
- lib/graphql/function.rb
|
326
374
|
- lib/graphql/id_type.rb
|
327
375
|
- lib/graphql/input_object_type.rb
|
328
376
|
- lib/graphql/int_type.rb
|
@@ -330,7 +378,7 @@ files:
|
|
330
378
|
- lib/graphql/internal_representation.rb
|
331
379
|
- lib/graphql/internal_representation/node.rb
|
332
380
|
- lib/graphql/internal_representation/rewrite.rb
|
333
|
-
- lib/graphql/internal_representation/
|
381
|
+
- lib/graphql/internal_representation/visit.rb
|
334
382
|
- lib/graphql/introspection.rb
|
335
383
|
- lib/graphql/introspection/arguments_field.rb
|
336
384
|
- lib/graphql/introspection/directive_location_enum.rb
|
@@ -391,6 +439,7 @@ files:
|
|
391
439
|
- lib/graphql/relay/mutation.rb
|
392
440
|
- lib/graphql/relay/node.rb
|
393
441
|
- lib/graphql/relay/page_info.rb
|
442
|
+
- lib/graphql/relay/range_add.rb
|
394
443
|
- lib/graphql/relay/relation_connection.rb
|
395
444
|
- lib/graphql/runtime_type_error.rb
|
396
445
|
- lib/graphql/scalar_type.rb
|
@@ -398,6 +447,7 @@ files:
|
|
398
447
|
- lib/graphql/schema/base_64_encoder.rb
|
399
448
|
- lib/graphql/schema/build_from_definition.rb
|
400
449
|
- lib/graphql/schema/catchall_middleware.rb
|
450
|
+
- lib/graphql/schema/default_parse_error.rb
|
401
451
|
- lib/graphql/schema/default_type_error.rb
|
402
452
|
- lib/graphql/schema/instrumented_field_map.rb
|
403
453
|
- lib/graphql/schema/invalid_type_error.rb
|
@@ -417,6 +467,7 @@ files:
|
|
417
467
|
- lib/graphql/static_validation.rb
|
418
468
|
- lib/graphql/static_validation/all_rules.rb
|
419
469
|
- lib/graphql/static_validation/arguments_validator.rb
|
470
|
+
- lib/graphql/static_validation/definition_dependencies.rb
|
420
471
|
- lib/graphql/static_validation/literal_validator.rb
|
421
472
|
- lib/graphql/static_validation/message.rb
|
422
473
|
- lib/graphql/static_validation/rules/argument_literals_are_compatible.rb
|
@@ -426,6 +477,7 @@ files:
|
|
426
477
|
- lib/graphql/static_validation/rules/fields_are_defined_on_type.rb
|
427
478
|
- lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb
|
428
479
|
- lib/graphql/static_validation/rules/fields_will_merge.rb
|
480
|
+
- lib/graphql/static_validation/rules/fragment_names_are_unique.rb
|
429
481
|
- lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb
|
430
482
|
- lib/graphql/static_validation/rules/fragment_types_exist.rb
|
431
483
|
- lib/graphql/static_validation/rules/fragments_are_finite.rb
|
@@ -450,6 +502,14 @@ files:
|
|
450
502
|
- lib/graphql/unresolved_type_error.rb
|
451
503
|
- lib/graphql/version.rb
|
452
504
|
- readme.md
|
505
|
+
- spec/generators/graphql/enum_generator_spec.rb
|
506
|
+
- spec/generators/graphql/function_generator_spec.rb
|
507
|
+
- spec/generators/graphql/install_generator_spec.rb
|
508
|
+
- spec/generators/graphql/interface_generator_spec.rb
|
509
|
+
- spec/generators/graphql/loader_generator_spec.rb
|
510
|
+
- spec/generators/graphql/mutation_generator_spec.rb
|
511
|
+
- spec/generators/graphql/object_generator_spec.rb
|
512
|
+
- spec/generators/graphql/union_generator_spec.rb
|
453
513
|
- spec/graphql/analysis/analyze_query_spec.rb
|
454
514
|
- spec/graphql/analysis/field_usage_spec.rb
|
455
515
|
- spec/graphql/analysis/max_query_complexity_spec.rb
|
@@ -474,6 +534,7 @@ files:
|
|
474
534
|
- spec/graphql/execution_error_spec.rb
|
475
535
|
- spec/graphql/field_spec.rb
|
476
536
|
- spec/graphql/float_type_spec.rb
|
537
|
+
- spec/graphql/function_spec.rb
|
477
538
|
- spec/graphql/id_type_spec.rb
|
478
539
|
- spec/graphql/input_object_type_spec.rb
|
479
540
|
- spec/graphql/int_type_spec.rb
|
@@ -503,10 +564,12 @@ files:
|
|
503
564
|
- spec/graphql/relay/array_connection_spec.rb
|
504
565
|
- spec/graphql/relay/base_connection_spec.rb
|
505
566
|
- spec/graphql/relay/connection_field_spec.rb
|
567
|
+
- spec/graphql/relay/connection_resolve_spec.rb
|
506
568
|
- spec/graphql/relay/connection_type_spec.rb
|
507
569
|
- spec/graphql/relay/mutation_spec.rb
|
508
570
|
- spec/graphql/relay/node_spec.rb
|
509
571
|
- spec/graphql/relay/page_info_spec.rb
|
572
|
+
- spec/graphql/relay/range_add_spec.rb
|
510
573
|
- spec/graphql/relay/relation_connection_spec.rb
|
511
574
|
- spec/graphql/scalar_type_spec.rb
|
512
575
|
- spec/graphql/schema/build_from_definition_spec.rb
|
@@ -529,6 +592,7 @@ files:
|
|
529
592
|
- spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb
|
530
593
|
- spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb
|
531
594
|
- spec/graphql/static_validation/rules/fields_will_merge_spec.rb
|
595
|
+
- spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
|
532
596
|
- spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb
|
533
597
|
- spec/graphql/static_validation/rules/fragment_types_exist_spec.rb
|
534
598
|
- spec/graphql/static_validation/rules/fragments_are_finite_spec.rb
|
@@ -549,6 +613,7 @@ files:
|
|
549
613
|
- spec/graphql/string_type_spec.rb
|
550
614
|
- spec/graphql/union_type_spec.rb
|
551
615
|
- spec/spec_helper.rb
|
616
|
+
- spec/support/base_generator_test.rb
|
552
617
|
- spec/support/dummy/data.rb
|
553
618
|
- spec/support/dummy/schema.rb
|
554
619
|
- spec/support/minimum_input_object.rb
|
@@ -578,8 +643,16 @@ rubyforge_project:
|
|
578
643
|
rubygems_version: 2.6.10
|
579
644
|
signing_key:
|
580
645
|
specification_version: 4
|
581
|
-
summary: A GraphQL
|
646
|
+
summary: A GraphQL language and runtime for Ruby
|
582
647
|
test_files:
|
648
|
+
- spec/generators/graphql/enum_generator_spec.rb
|
649
|
+
- spec/generators/graphql/function_generator_spec.rb
|
650
|
+
- spec/generators/graphql/install_generator_spec.rb
|
651
|
+
- spec/generators/graphql/interface_generator_spec.rb
|
652
|
+
- spec/generators/graphql/loader_generator_spec.rb
|
653
|
+
- spec/generators/graphql/mutation_generator_spec.rb
|
654
|
+
- spec/generators/graphql/object_generator_spec.rb
|
655
|
+
- spec/generators/graphql/union_generator_spec.rb
|
583
656
|
- spec/graphql/analysis/analyze_query_spec.rb
|
584
657
|
- spec/graphql/analysis/field_usage_spec.rb
|
585
658
|
- spec/graphql/analysis/max_query_complexity_spec.rb
|
@@ -604,6 +677,7 @@ test_files:
|
|
604
677
|
- spec/graphql/execution_error_spec.rb
|
605
678
|
- spec/graphql/field_spec.rb
|
606
679
|
- spec/graphql/float_type_spec.rb
|
680
|
+
- spec/graphql/function_spec.rb
|
607
681
|
- spec/graphql/id_type_spec.rb
|
608
682
|
- spec/graphql/input_object_type_spec.rb
|
609
683
|
- spec/graphql/int_type_spec.rb
|
@@ -633,10 +707,12 @@ test_files:
|
|
633
707
|
- spec/graphql/relay/array_connection_spec.rb
|
634
708
|
- spec/graphql/relay/base_connection_spec.rb
|
635
709
|
- spec/graphql/relay/connection_field_spec.rb
|
710
|
+
- spec/graphql/relay/connection_resolve_spec.rb
|
636
711
|
- spec/graphql/relay/connection_type_spec.rb
|
637
712
|
- spec/graphql/relay/mutation_spec.rb
|
638
713
|
- spec/graphql/relay/node_spec.rb
|
639
714
|
- spec/graphql/relay/page_info_spec.rb
|
715
|
+
- spec/graphql/relay/range_add_spec.rb
|
640
716
|
- spec/graphql/relay/relation_connection_spec.rb
|
641
717
|
- spec/graphql/scalar_type_spec.rb
|
642
718
|
- spec/graphql/schema/build_from_definition_spec.rb
|
@@ -659,6 +735,7 @@ test_files:
|
|
659
735
|
- spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb
|
660
736
|
- spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb
|
661
737
|
- spec/graphql/static_validation/rules/fields_will_merge_spec.rb
|
738
|
+
- spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
|
662
739
|
- spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb
|
663
740
|
- spec/graphql/static_validation/rules/fragment_types_exist_spec.rb
|
664
741
|
- spec/graphql/static_validation/rules/fragments_are_finite_spec.rb
|
@@ -679,6 +756,7 @@ test_files:
|
|
679
756
|
- spec/graphql/string_type_spec.rb
|
680
757
|
- spec/graphql/union_type_spec.rb
|
681
758
|
- spec/spec_helper.rb
|
759
|
+
- spec/support/base_generator_test.rb
|
682
760
|
- spec/support/dummy/data.rb
|
683
761
|
- spec/support/dummy/schema.rb
|
684
762
|
- spec/support/minimum_input_object.rb
|