Browse Source

Merge pull request #13 from Comcast/feature/subscription-type

Add simple subscription type to satisfy clients that use a newer spec
Bjorn Swenson 8 years ago
parent
commit
8b3eff38f7
2 changed files with 14 additions and 1 deletions
  1. 9 1
      graphql/introspection.lua
  2. 5 0
      graphql/schema.lua

+ 9 - 1
graphql/introspection.lua

@@ -44,7 +44,15 @@ __Schema = types.object({
         resolve = function(schema)
           return schema.directives
         end
-      }
+      },
+
+      subscriptionType = {
+        description = 'If this server supports subscriptions, the type that subscription operations will be rooted at',
+        kind = __Type,
+        resolve = function(schema)
+          return schema:getSubscriptionType()
+        end
+       }
     }
   end
 })

+ 5 - 0
graphql/schema.lua

@@ -26,6 +26,7 @@ function schema.create(config)
 
   self:generateTypeMap(self.query)
   self:generateTypeMap(self.mutation)
+  self:generateTypeMap(self.subscription)
   self:generateTypeMap(introspection.__Schema)
   self:generateDirectiveMap()
 
@@ -99,6 +100,10 @@ function schema:getMutationType()
   return self.mutation
 end
 
+function schema:getSubscriptionType()
+  return self.subscription
+end
+
 function schema:getTypeMap()
   return self.typeMap
 end