github.com/maeglindeveloper/gqlgen@v0.13.1-0.20210413081235-57808b12a0a0/graphql/handler/extension/introspection.go (about)

     1  package extension
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/99designs/gqlgen/graphql"
     7  	"github.com/vektah/gqlparser/v2/gqlerror"
     8  )
     9  
    10  // EnableIntrospection enables clients to reflect all of the types available on the graph.
    11  type Introspection struct{}
    12  
    13  var _ interface {
    14  	graphql.OperationContextMutator
    15  	graphql.HandlerExtension
    16  } = Introspection{}
    17  
    18  func (c Introspection) ExtensionName() string {
    19  	return "Introspection"
    20  }
    21  
    22  func (c Introspection) Validate(schema graphql.ExecutableSchema) error {
    23  	return nil
    24  }
    25  
    26  func (c Introspection) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error {
    27  	rc.DisableIntrospection = false
    28  	return nil
    29  }