graphql-python / graphql-core

A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.
MIT License
502 stars 133 forks source link

I use middleware for that right now #215

Open amansingh0912 opened 4 months ago

amansingh0912 commented 4 months ago
          I use middleware for that right now
class HideIntrospectMiddleware:
    """
    This middleware should use for production mode. This class hide the
    introspection.
    """
    def resolve(self, next, root, info, **args):
        if info.field_name == '__schema':
            return None
        return next(root, info, **args)

Originally posted by @Arfey in a Graphene issue, but it gives an error "Cannot return null for non-nullable field Query.__schema."

Cito commented 4 months ago

Can you please change the title and description to make this an actually relevant issue. Is this a request, bug report, or suggestion?