Skip to content

Commit 448c050

Browse files
author
Jannis Pohlmann
committed
subscriptions: Store the validated GraphQL document in subscriptions
1 parent 43aa191 commit 448c050

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subscriptions.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/graphql-go/graphql"
77
"github.com/graphql-go/graphql/gqlerrors"
8+
"github.com/graphql-go/graphql/language/ast"
89
"github.com/graphql-go/graphql/language/parser"
910
log "github.com/sirupsen/logrus"
1011
)
@@ -31,6 +32,7 @@ type Subscription struct {
3132
Variables map[string]interface{}
3233
OperationName string
3334
SendData SubscriptionSendDataFunc
35+
Document *ast.Document
3436
}
3537

3638
// ConnectionSubscriptions defines a map of all subscriptions of
@@ -108,6 +110,9 @@ func (m *subscriptionManager) AddSubscription(
108110
return ErrorsFromGraphQLErrors(validation.Errors)
109111
}
110112

113+
// Remember the query document for later
114+
subscription.Document = document
115+
111116
// Allocate the connection's map of subscription IDs to
112117
// subscriptions on demand
113118
if m.subscriptions[conn] == nil {

0 commit comments

Comments
 (0)