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)
169169 def build_fields ( type_defn , fields , type_resolver )
170170 loader = self
171171 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+
172178 type_defn . field (
173179 field_hash [ "name" ] ,
174180 type : type_resolver . call ( field_hash [ "type" ] ) ,
175181 description : field_hash [ "description" ] ,
176182 deprecation_reason : field_hash [ "deprecationReason" ] ,
177183 null : true ,
178184 camelize : false ,
185+ connection_extension : nil ,
186+ connection : type_name . end_with? ( "Connection" ) ,
179187 ) do
180188 if field_hash [ "args" ] . any?
181189 loader . build_arguments ( self , field_hash [ "args" ] , type_resolver )
Original file line number Diff line number Diff line change 190190
191191 describe ".from_introspection" do
192192 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
193198
194199 query_root = Class . new ( GraphQL ::Schema ::Object ) do
195200 graphql_name 'Query'
196201 field :str , String , null : true
202+ field :db , db_connection , null : false , connection : false
197203 end
198204
199205 Class . new ( GraphQL ::Schema ) do
You can’t perform that action at this time.
0 commit comments