File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
spec/integration/rails/graphql Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -169,13 +169,21 @@ def define_directive(directive, type_resolver)
169
169
def build_fields ( type_defn , fields , type_resolver )
170
170
loader = self
171
171
fields . each do |field_hash |
172
+ unwrapped_field_hash = field_hash
173
+ while ( of_type = unwrapped_field_hash [ "ofType" ] )
174
+ unwrapped_field_hash = of_type
175
+ end
176
+ type_name = unwrapped_field_hash [ "name" ]
177
+
172
178
type_defn . field (
173
179
field_hash [ "name" ] ,
174
180
type : type_resolver . call ( field_hash [ "type" ] ) ,
175
181
description : field_hash [ "description" ] ,
176
182
deprecation_reason : field_hash [ "deprecationReason" ] ,
177
183
null : true ,
178
184
camelize : false ,
185
+ connection_extension : nil ,
186
+ connection : type_name . end_with? ( "Connection" ) ,
179
187
) do
180
188
if field_hash [ "args" ] . any?
181
189
loader . build_arguments ( self , field_hash [ "args" ] , type_resolver )
Original file line number Diff line number Diff line change 190
190
191
191
describe ".from_introspection" do
192
192
let ( :schema ) {
193
+ # This type would easily be mistaken for a connection... but it's not one.
194
+ db_connection = Class . new ( GraphQL ::Schema ::Object ) do
195
+ graphql_name "DatabaseConnection"
196
+ field :name , String , null : false
197
+ end
193
198
194
199
query_root = Class . new ( GraphQL ::Schema ::Object ) do
195
200
graphql_name 'Query'
196
201
field :str , String , null : true
202
+ field :db , db_connection , null : false , connection : false
197
203
end
198
204
199
205
Class . new ( GraphQL ::Schema ) do
You can’t perform that action at this time.
0 commit comments