Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GraphQL): fix internal error when doing GraphQL schema introspection after drop all #6268

Merged
merged 5 commits into from
Aug 27, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions graphql/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,18 @@ func (as *adminServer) resetSchema(gqlSchema schema.Schema) {
// set status as updating schema
mainHealthStore.updatingSchema()

resolverFactory := resolverFactoryWithErrorMsg(errResolverNotFound)
// it is nil after drop_all
if gqlSchema != nil {
resolverFactory = resolverFactory.WithConventionResolvers(gqlSchema, as.fns)
}
if as.withIntrospection {
resolverFactory.WithSchemaIntrospection()
var resolverFactory resolve.ResolverFactory
// If schema is nil (which becomes after drop_all) then do not attach Resolver for
// introspection operations, and set GQL schema to empty.
if gqlSchema == nil {
resolverFactory = resolverFactoryWithErrorMsg(errNoGraphQLSchema)
gqlSchema, _ = schema.FromString("")
} else {
resolverFactory = resolverFactoryWithErrorMsg(errResolverNotFound).
WithConventionResolvers(gqlSchema, as.fns)
if as.withIntrospection {
resolverFactory.WithSchemaIntrospection()
}
}

// Increment the Epoch when you get a new schema. So, that subscription's local epoch
Expand Down