Fix argument list in middleware docs

Using the literal example for AuthorizationMiddleware leads to the following error:

`graphql.error.located_error.GraphQLLocatedError: resolve() takes 3 positional arguments but 4 were given`

If `AuthorizationMiddleware` is to be instantiated, it should receive `self` as the first argument.
This commit is contained in:
Zbigniew Siciarz 2019-10-03 15:52:52 +02:00 committed by GitHub
parent 7c7876d37c
commit 3710531f3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ This middleware only continues evaluation if the ``field_name`` is not ``'user'`
.. code:: python .. code:: python
class AuthorizationMiddleware(object): class AuthorizationMiddleware(object):
def resolve(next, root, info, **args): def resolve(self, next, root, info, **args):
if info.field_name == 'user': if info.field_name == 'user':
return None return None
return next(root, info, **args) return next(root, info, **args)