graphql 1.2.6 → 1.3.0
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 +3 -1
- data/lib/graphql/analysis.rb +1 -0
- data/lib/graphql/analysis/analyze_query.rb +1 -0
- data/lib/graphql/analysis/field_usage.rb +1 -0
- data/lib/graphql/analysis/max_query_complexity.rb +1 -0
- data/lib/graphql/analysis/max_query_depth.rb +1 -0
- data/lib/graphql/analysis/query_complexity.rb +1 -0
- data/lib/graphql/analysis/query_depth.rb +1 -0
- data/lib/graphql/analysis/reducer_state.rb +1 -0
- data/lib/graphql/analysis_error.rb +1 -0
- data/lib/graphql/argument.rb +1 -0
- data/lib/graphql/base_type.rb +16 -7
- data/lib/graphql/boolean_type.rb +1 -0
- data/lib/graphql/compatibility.rb +2 -0
- data/lib/graphql/compatibility/execution_specification.rb +113 -192
- data/lib/graphql/compatibility/execution_specification/counter_schema.rb +53 -0
- data/lib/graphql/compatibility/execution_specification/specification_schema.rb +195 -0
- data/lib/graphql/compatibility/lazy_execution_specification.rb +186 -0
- data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +97 -0
- data/lib/graphql/compatibility/query_parser_specification.rb +1 -0
- data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +1 -0
- data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +1 -0
- data/lib/graphql/compatibility/schema_parser_specification.rb +1 -0
- data/lib/graphql/define.rb +1 -0
- data/lib/graphql/define/assign_argument.rb +1 -0
- data/lib/graphql/define/assign_connection.rb +1 -0
- data/lib/graphql/define/assign_enum_value.rb +1 -0
- data/lib/graphql/define/assign_global_id_field.rb +1 -0
- data/lib/graphql/define/assign_object_field.rb +1 -0
- data/lib/graphql/define/defined_object_proxy.rb +1 -0
- data/lib/graphql/define/instance_definable.rb +11 -12
- data/lib/graphql/define/non_null_with_bang.rb +1 -0
- data/lib/graphql/define/type_definer.rb +1 -0
- data/lib/graphql/directive.rb +1 -0
- data/lib/graphql/directive/deprecated_directive.rb +1 -0
- data/lib/graphql/directive/include_directive.rb +1 -0
- data/lib/graphql/directive/skip_directive.rb +1 -0
- data/lib/graphql/enum_type.rb +8 -1
- data/lib/graphql/execution.rb +5 -0
- data/lib/graphql/execution/directive_checks.rb +1 -0
- data/lib/graphql/execution/execute.rb +222 -0
- data/lib/graphql/execution/field_result.rb +52 -0
- data/lib/graphql/execution/lazy.rb +59 -0
- data/lib/graphql/execution/lazy/lazy_method_map.rb +38 -0
- data/lib/graphql/execution/lazy/resolve.rb +68 -0
- data/lib/graphql/execution/selection_result.rb +84 -0
- data/lib/graphql/execution/typecast.rb +4 -4
- data/lib/graphql/execution_error.rb +1 -0
- data/lib/graphql/field.rb +68 -18
- data/lib/graphql/field/resolve.rb +1 -0
- data/lib/graphql/float_type.rb +1 -0
- data/lib/graphql/id_type.rb +1 -0
- data/lib/graphql/input_object_type.rb +6 -0
- data/lib/graphql/int_type.rb +1 -0
- data/lib/graphql/interface_type.rb +6 -0
- data/lib/graphql/internal_representation.rb +2 -1
- data/lib/graphql/internal_representation/node.rb +2 -1
- data/lib/graphql/internal_representation/rewrite.rb +1 -0
- data/lib/graphql/internal_representation/selection.rb +85 -0
- data/lib/graphql/introspection.rb +1 -0
- data/lib/graphql/introspection/arguments_field.rb +1 -0
- data/lib/graphql/introspection/directive_location_enum.rb +1 -0
- data/lib/graphql/introspection/directive_type.rb +1 -0
- data/lib/graphql/introspection/enum_value_type.rb +1 -0
- data/lib/graphql/introspection/enum_values_field.rb +1 -0
- data/lib/graphql/introspection/field_type.rb +1 -0
- data/lib/graphql/introspection/fields_field.rb +1 -0
- data/lib/graphql/introspection/input_fields_field.rb +1 -0
- data/lib/graphql/introspection/input_value_type.rb +2 -1
- data/lib/graphql/introspection/interfaces_field.rb +1 -0
- data/lib/graphql/introspection/introspection_query.rb +1 -0
- data/lib/graphql/introspection/of_type_field.rb +1 -0
- data/lib/graphql/introspection/possible_types_field.rb +1 -0
- data/lib/graphql/introspection/schema_field.rb +1 -0
- data/lib/graphql/introspection/schema_type.rb +1 -0
- data/lib/graphql/introspection/type_by_name_field.rb +1 -0
- data/lib/graphql/introspection/type_kind_enum.rb +1 -0
- data/lib/graphql/introspection/type_type.rb +1 -0
- data/lib/graphql/introspection/typename_field.rb +1 -0
- data/lib/graphql/invalid_null_error.rb +17 -7
- data/lib/graphql/language.rb +10 -0
- data/lib/graphql/language/comments.rb +2 -1
- data/lib/graphql/language/definition_slice.rb +1 -0
- data/lib/graphql/language/generation.rb +25 -24
- data/lib/graphql/language/nodes.rb +1 -0
- data/lib/graphql/language/token.rb +1 -0
- data/lib/graphql/language/visitor.rb +1 -0
- data/lib/graphql/list_type.rb +1 -0
- data/lib/graphql/non_null_type.rb +2 -1
- data/lib/graphql/object_type.rb +12 -0
- data/lib/graphql/query.rb +40 -43
- data/lib/graphql/query/arguments.rb +1 -0
- data/lib/graphql/query/context.rb +31 -7
- data/lib/graphql/query/executor.rb +8 -1
- data/lib/graphql/query/input_validation_result.rb +1 -0
- data/lib/graphql/query/literal_input.rb +1 -0
- data/lib/graphql/query/serial_execution.rb +3 -4
- data/lib/graphql/query/serial_execution/field_resolution.rb +15 -10
- data/lib/graphql/query/serial_execution/operation_resolution.rb +3 -5
- data/lib/graphql/query/serial_execution/selection_resolution.rb +4 -5
- data/lib/graphql/query/serial_execution/value_resolution.rb +26 -11
- data/lib/graphql/query/variable_validation_error.rb +1 -0
- data/lib/graphql/query/variables.rb +1 -0
- data/lib/graphql/relay.rb +1 -0
- data/lib/graphql/relay/array_connection.rb +3 -2
- data/lib/graphql/relay/base_connection.rb +20 -8
- data/lib/graphql/relay/connection_field.rb +1 -0
- data/lib/graphql/relay/connection_resolve.rb +14 -1
- data/lib/graphql/relay/connection_type.rb +1 -0
- data/lib/graphql/relay/edge.rb +1 -0
- data/lib/graphql/relay/edge_type.rb +1 -0
- data/lib/graphql/relay/global_id_resolve.rb +1 -0
- data/lib/graphql/relay/mutation.rb +13 -0
- data/lib/graphql/relay/node.rb +1 -0
- data/lib/graphql/relay/page_info.rb +1 -0
- data/lib/graphql/relay/relation_connection.rb +3 -2
- data/lib/graphql/runtime_type_error.rb +4 -0
- data/lib/graphql/scalar_type.rb +2 -1
- data/lib/graphql/schema.rb +116 -26
- data/lib/graphql/schema/base_64_encoder.rb +14 -0
- data/lib/graphql/schema/build_from_definition.rb +4 -0
- data/lib/graphql/schema/catchall_middleware.rb +1 -0
- data/lib/graphql/schema/default_type_error.rb +15 -0
- data/lib/graphql/schema/instrumented_field_map.rb +1 -0
- data/lib/graphql/schema/invalid_type_error.rb +1 -0
- data/lib/graphql/schema/loader.rb +5 -1
- data/lib/graphql/schema/middleware_chain.rb +1 -0
- data/lib/graphql/schema/possible_types.rb +1 -0
- data/lib/graphql/schema/printer.rb +3 -2
- data/lib/graphql/schema/reduce_types.rb +1 -0
- data/lib/graphql/schema/rescue_middleware.rb +3 -2
- data/lib/graphql/schema/timeout_middleware.rb +1 -0
- data/lib/graphql/schema/type_expression.rb +1 -0
- data/lib/graphql/schema/type_map.rb +1 -0
- data/lib/graphql/schema/unique_within_type.rb +1 -0
- data/lib/graphql/schema/validation.rb +57 -1
- data/lib/graphql/schema/warden.rb +1 -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 +1 -0
- data/lib/graphql/static_validation/literal_validator.rb +1 -0
- data/lib/graphql/static_validation/message.rb +1 -0
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -0
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +1 -0
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +1 -0
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +6 -3
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +1 -0
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_named.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_used.rb +1 -0
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -0
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -0
- data/lib/graphql/static_validation/rules/subscription_root_exists.rb +1 -0
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +1 -0
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +1 -0
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +1 -0
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +1 -0
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +1 -0
- data/lib/graphql/static_validation/type_stack.rb +1 -0
- data/lib/graphql/static_validation/validation_context.rb +2 -1
- data/lib/graphql/static_validation/validator.rb +2 -1
- data/lib/graphql/string_type.rb +1 -0
- data/lib/graphql/type_kinds.rb +1 -0
- data/lib/graphql/union_type.rb +13 -0
- data/lib/graphql/unresolved_type_error.rb +26 -5
- data/lib/graphql/version.rb +2 -1
- data/readme.md +1 -5
- data/spec/graphql/analysis/analyze_query_spec.rb +1 -0
- data/spec/graphql/analysis/field_usage_spec.rb +1 -0
- data/spec/graphql/analysis/max_query_complexity_spec.rb +1 -0
- data/spec/graphql/analysis/max_query_depth_spec.rb +1 -0
- data/spec/graphql/analysis/query_complexity_spec.rb +1 -0
- data/spec/graphql/analysis/query_depth_spec.rb +1 -0
- data/spec/graphql/argument_spec.rb +1 -0
- data/spec/graphql/base_type_spec.rb +13 -0
- data/spec/graphql/boolean_type_spec.rb +1 -0
- data/spec/graphql/compatibility/execution_specification_spec.rb +1 -0
- data/spec/graphql/compatibility/lazy_execution_specification_spec.rb +4 -0
- data/spec/graphql/compatibility/query_parser_specification_spec.rb +1 -0
- data/spec/graphql/compatibility/schema_parser_specification_spec.rb +1 -0
- data/spec/graphql/define/assign_argument_spec.rb +1 -0
- data/spec/graphql/define/instance_definable_spec.rb +1 -0
- data/spec/graphql/directive_spec.rb +1 -0
- data/spec/graphql/enum_type_spec.rb +10 -0
- data/spec/graphql/execution/execute_spec.rb +5 -0
- data/spec/graphql/execution/lazy_spec.rb +252 -0
- data/spec/graphql/execution/typecast_spec.rb +1 -0
- data/spec/graphql/execution_error_spec.rb +1 -0
- data/spec/graphql/field_spec.rb +17 -0
- data/spec/graphql/float_type_spec.rb +1 -0
- data/spec/graphql/id_type_spec.rb +1 -0
- data/spec/graphql/input_object_type_spec.rb +10 -0
- data/spec/graphql/int_type_spec.rb +1 -0
- data/spec/graphql/interface_type_spec.rb +10 -0
- data/spec/graphql/internal_representation/rewrite_spec.rb +1 -0
- data/spec/graphql/introspection/directive_type_spec.rb +1 -0
- data/spec/graphql/introspection/input_value_type_spec.rb +1 -0
- data/spec/graphql/introspection/introspection_query_spec.rb +1 -0
- data/spec/graphql/introspection/schema_type_spec.rb +1 -0
- data/spec/graphql/introspection/type_type_spec.rb +1 -0
- data/spec/graphql/language/definition_slice_spec.rb +1 -0
- data/spec/graphql/language/equality_spec.rb +1 -0
- data/spec/graphql/language/generation_spec.rb +1 -0
- data/spec/graphql/language/lexer_spec.rb +1 -0
- data/spec/graphql/language/nodes_spec.rb +1 -0
- data/spec/graphql/language/parser_spec.rb +1 -0
- data/spec/graphql/language/visitor_spec.rb +1 -0
- data/spec/graphql/list_type_spec.rb +1 -0
- data/spec/graphql/non_null_type_spec.rb +17 -0
- data/spec/graphql/object_type_spec.rb +19 -0
- data/spec/graphql/query/arguments_spec.rb +1 -0
- data/spec/graphql/query/context_spec.rb +1 -0
- data/spec/graphql/query/executor_spec.rb +1 -0
- data/spec/graphql/query/serial_execution/value_resolution_spec.rb +1 -0
- data/spec/graphql/query/variables_spec.rb +1 -0
- data/spec/graphql/query_spec.rb +25 -0
- data/spec/graphql/relay/array_connection_spec.rb +1 -0
- data/spec/graphql/relay/base_connection_spec.rb +33 -4
- data/spec/graphql/relay/connection_field_spec.rb +1 -0
- data/spec/graphql/relay/connection_type_spec.rb +1 -0
- data/spec/graphql/relay/mutation_spec.rb +6 -0
- data/spec/graphql/relay/node_spec.rb +1 -0
- data/spec/graphql/relay/page_info_spec.rb +1 -0
- data/spec/graphql/relay/relation_connection_spec.rb +1 -0
- data/spec/graphql/scalar_type_spec.rb +1 -0
- data/spec/graphql/schema/build_from_definition_spec.rb +9 -1
- data/spec/graphql/schema/catchall_middleware_spec.rb +1 -0
- data/spec/graphql/schema/loader_spec.rb +7 -0
- data/spec/graphql/schema/middleware_chain_spec.rb +1 -0
- data/spec/graphql/schema/printer_spec.rb +1 -0
- data/spec/graphql/schema/reduce_types_spec.rb +1 -0
- data/spec/graphql/schema/rescue_middleware_spec.rb +1 -0
- data/spec/graphql/schema/timeout_middleware_spec.rb +1 -0
- data/spec/graphql/schema/type_expression_spec.rb +1 -0
- data/spec/graphql/schema/unique_within_type_spec.rb +1 -0
- data/spec/graphql/schema/validation_spec.rb +55 -0
- data/spec/graphql/schema/warden_spec.rb +1 -0
- data/spec/graphql/schema_spec.rb +39 -0
- data/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/directives_are_defined_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +515 -31
- data/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fragments_are_named_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +1 -0
- data/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +1 -0
- data/spec/graphql/static_validation/type_stack_spec.rb +1 -0
- data/spec/graphql/static_validation/validator_spec.rb +1 -0
- data/spec/graphql/string_type_spec.rb +1 -0
- data/spec/graphql/union_type_spec.rb +11 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/dairy_app.rb +1 -0
- data/spec/support/dairy_data.rb +1 -0
- data/spec/support/minimum_input_object.rb +1 -0
- data/spec/support/star_wars_data.rb +1 -0
- data/spec/support/star_wars_schema.rb +30 -7
- data/spec/support/static_validation_helpers.rb +1 -0
- metadata +24 -5
- data/lib/graphql/internal_representation/selections.rb +0 -41
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "spec_helper"
|
2
3
|
|
3
4
|
describe GraphQL::UnionType do
|
@@ -94,4 +95,14 @@ describe GraphQL::UnionType do
|
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|
98
|
+
|
99
|
+
describe "#dup" do
|
100
|
+
it "copies possible types without affecting the orginal" do
|
101
|
+
union.possible_types # load the internal cache
|
102
|
+
union_2 = union.dup
|
103
|
+
union_2.possible_types << type_3
|
104
|
+
assert_equal 2, union.possible_types.size
|
105
|
+
assert_equal 3, union_2.possible_types.size
|
106
|
+
end
|
107
|
+
end
|
97
108
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/dairy_app.rb
CHANGED
data/spec/support/dairy_data.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Adapted from graphql-relay-js
|
2
3
|
# https://github.com/graphql/graphql-relay-js/blob/master/src/__tests__/starWarsSchema.js
|
3
4
|
|
@@ -157,16 +158,36 @@ IntroduceShipMutation = GraphQL::Relay::Mutation.define do
|
|
157
158
|
# Here's the mutation operation:
|
158
159
|
resolve ->(root_obj, inputs, ctx) {
|
159
160
|
faction_id = inputs["factionId"]
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
161
|
+
if inputs["shipName"] == 'Millennium Falcon'
|
162
|
+
GraphQL::ExecutionError.new("Sorry, Millennium Falcon ship is reserved")
|
163
|
+
|
164
|
+
else
|
165
|
+
ship = STAR_WARS_DATA.create_ship(inputs["shipName"], faction_id)
|
166
|
+
faction = STAR_WARS_DATA["Faction"][faction_id]
|
167
|
+
connection_class = GraphQL::Relay::BaseConnection.connection_for_nodes(faction.ships)
|
168
|
+
ships_connection = connection_class.new(faction.ships, inputs)
|
169
|
+
ship_edge = GraphQL::Relay::Edge.new(ship, ships_connection)
|
170
|
+
result = {
|
171
|
+
shipEdge: ship_edge,
|
172
|
+
faction: faction
|
173
|
+
}
|
174
|
+
if inputs["shipName"] == "Slave II"
|
175
|
+
LazyWrapper.new(result)
|
176
|
+
else
|
177
|
+
result
|
178
|
+
end
|
179
|
+
end
|
167
180
|
}
|
168
181
|
end
|
169
182
|
|
183
|
+
|
184
|
+
class LazyWrapper
|
185
|
+
attr_reader :value
|
186
|
+
def initialize(value)
|
187
|
+
@value = value
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
170
191
|
QueryType = GraphQL::ObjectType.define do
|
171
192
|
name "Query"
|
172
193
|
field :rebels, Faction do
|
@@ -216,4 +237,6 @@ StarWarsSchema = GraphQL::Schema.define do
|
|
216
237
|
id_from_object ->(object, type, ctx) do
|
217
238
|
GraphQL::Schema::UniqueWithinType.encode(type.name, object.id)
|
218
239
|
end
|
240
|
+
|
241
|
+
lazy_resolve(LazyWrapper, :value)
|
219
242
|
end
|
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.
|
4
|
+
version: 1.3.0
|
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-12-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 5.9.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 5.9.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-focus
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,6 +273,10 @@ files:
|
|
273
273
|
- lib/graphql/boolean_type.rb
|
274
274
|
- lib/graphql/compatibility.rb
|
275
275
|
- lib/graphql/compatibility/execution_specification.rb
|
276
|
+
- lib/graphql/compatibility/execution_specification/counter_schema.rb
|
277
|
+
- lib/graphql/compatibility/execution_specification/specification_schema.rb
|
278
|
+
- lib/graphql/compatibility/lazy_execution_specification.rb
|
279
|
+
- lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb
|
276
280
|
- lib/graphql/compatibility/query_parser_specification.rb
|
277
281
|
- lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb
|
278
282
|
- lib/graphql/compatibility/query_parser_specification/query_assertions.rb
|
@@ -294,6 +298,12 @@ files:
|
|
294
298
|
- lib/graphql/enum_type.rb
|
295
299
|
- lib/graphql/execution.rb
|
296
300
|
- lib/graphql/execution/directive_checks.rb
|
301
|
+
- lib/graphql/execution/execute.rb
|
302
|
+
- lib/graphql/execution/field_result.rb
|
303
|
+
- lib/graphql/execution/lazy.rb
|
304
|
+
- lib/graphql/execution/lazy/lazy_method_map.rb
|
305
|
+
- lib/graphql/execution/lazy/resolve.rb
|
306
|
+
- lib/graphql/execution/selection_result.rb
|
297
307
|
- lib/graphql/execution/typecast.rb
|
298
308
|
- lib/graphql/execution_error.rb
|
299
309
|
- lib/graphql/field.rb
|
@@ -306,7 +316,7 @@ files:
|
|
306
316
|
- lib/graphql/internal_representation.rb
|
307
317
|
- lib/graphql/internal_representation/node.rb
|
308
318
|
- lib/graphql/internal_representation/rewrite.rb
|
309
|
-
- lib/graphql/internal_representation/
|
319
|
+
- lib/graphql/internal_representation/selection.rb
|
310
320
|
- lib/graphql/introspection.rb
|
311
321
|
- lib/graphql/introspection/arguments_field.rb
|
312
322
|
- lib/graphql/introspection/directive_location_enum.rb
|
@@ -368,10 +378,13 @@ files:
|
|
368
378
|
- lib/graphql/relay/node.rb
|
369
379
|
- lib/graphql/relay/page_info.rb
|
370
380
|
- lib/graphql/relay/relation_connection.rb
|
381
|
+
- lib/graphql/runtime_type_error.rb
|
371
382
|
- lib/graphql/scalar_type.rb
|
372
383
|
- lib/graphql/schema.rb
|
384
|
+
- lib/graphql/schema/base_64_encoder.rb
|
373
385
|
- lib/graphql/schema/build_from_definition.rb
|
374
386
|
- lib/graphql/schema/catchall_middleware.rb
|
387
|
+
- lib/graphql/schema/default_type_error.rb
|
375
388
|
- lib/graphql/schema/instrumented_field_map.rb
|
376
389
|
- lib/graphql/schema/invalid_type_error.rb
|
377
390
|
- lib/graphql/schema/loader.rb
|
@@ -431,12 +444,15 @@ files:
|
|
431
444
|
- spec/graphql/base_type_spec.rb
|
432
445
|
- spec/graphql/boolean_type_spec.rb
|
433
446
|
- spec/graphql/compatibility/execution_specification_spec.rb
|
447
|
+
- spec/graphql/compatibility/lazy_execution_specification_spec.rb
|
434
448
|
- spec/graphql/compatibility/query_parser_specification_spec.rb
|
435
449
|
- spec/graphql/compatibility/schema_parser_specification_spec.rb
|
436
450
|
- spec/graphql/define/assign_argument_spec.rb
|
437
451
|
- spec/graphql/define/instance_definable_spec.rb
|
438
452
|
- spec/graphql/directive_spec.rb
|
439
453
|
- spec/graphql/enum_type_spec.rb
|
454
|
+
- spec/graphql/execution/execute_spec.rb
|
455
|
+
- spec/graphql/execution/lazy_spec.rb
|
440
456
|
- spec/graphql/execution/typecast_spec.rb
|
441
457
|
- spec/graphql/execution_error_spec.rb
|
442
458
|
- spec/graphql/field_spec.rb
|
@@ -556,12 +572,15 @@ test_files:
|
|
556
572
|
- spec/graphql/base_type_spec.rb
|
557
573
|
- spec/graphql/boolean_type_spec.rb
|
558
574
|
- spec/graphql/compatibility/execution_specification_spec.rb
|
575
|
+
- spec/graphql/compatibility/lazy_execution_specification_spec.rb
|
559
576
|
- spec/graphql/compatibility/query_parser_specification_spec.rb
|
560
577
|
- spec/graphql/compatibility/schema_parser_specification_spec.rb
|
561
578
|
- spec/graphql/define/assign_argument_spec.rb
|
562
579
|
- spec/graphql/define/instance_definable_spec.rb
|
563
580
|
- spec/graphql/directive_spec.rb
|
564
581
|
- spec/graphql/enum_type_spec.rb
|
582
|
+
- spec/graphql/execution/execute_spec.rb
|
583
|
+
- spec/graphql/execution/lazy_spec.rb
|
565
584
|
- spec/graphql/execution/typecast_spec.rb
|
566
585
|
- spec/graphql/execution_error_spec.rb
|
567
586
|
- spec/graphql/field_spec.rb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module GraphQL
|
2
|
-
module InternalRepresentation
|
3
|
-
module Selections
|
4
|
-
def self.build(query, nodes)
|
5
|
-
# { type => { name => nodes } }
|
6
|
-
selections = Hash.new { |h, k| h[k] = Hash.new { |h2, k2| h2[k2] = [] } }
|
7
|
-
object_types = Set.new
|
8
|
-
|
9
|
-
warden = query.warden
|
10
|
-
ctx = query.context
|
11
|
-
|
12
|
-
nodes.each do |node|
|
13
|
-
node.typed_children.each_key do |type_cond|
|
14
|
-
object_types.merge(warden.possible_types(type_cond))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
nodes.each do |node|
|
19
|
-
node.typed_children.each do |type_cond, children|
|
20
|
-
object_types.each do |obj_type|
|
21
|
-
obj_selections = selections[obj_type]
|
22
|
-
skipped = []
|
23
|
-
if GraphQL::Execution::Typecast.compatible?(obj_type, type_cond, ctx)
|
24
|
-
children.each do |name, irep_node|
|
25
|
-
if irep_node.skipped?
|
26
|
-
skipped << name
|
27
|
-
else
|
28
|
-
obj_selections[name] << irep_node
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
skipped.each { |k| obj_selections.delete(k) }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
selections
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|