flavors / django-graphql-jwt

JSON Web Token (JWT) authentication for Graphene Django
https://django-graphql-jwt.domake.io
MIT License
819 stars 171 forks source link

fails if root object types not named Query and Mutation #304

Closed odigity closed 1 year ago

odigity commented 2 years ago

I believe this code is assuming the operation type ('query' or 'mutation') can be title-ized to produce the name of the root query and mutation types, but the GraphQL spec doesn't require that:

def allow_any(info, **kwargs):
    operation_name = get_operation_name(info.operation.operation).title()
    field = info.schema.get_type(operation_name).fields.get(info.field_name)

This fails if you have something like this:

class Foo(ObjectType):
    hello = String(default_value='Hi!')

schema = Schema(query=Foo)
nrbnlulu commented 2 years ago

I believe this repo is dead bruh... you should probably move on to Strawberry. P.S There are forked versions there of this repo and graphql-django-auth repo

odigity commented 2 years ago

Yeah, I've noticed the rot and cobwebs on both this package and graphene. At the moment, I'm tasked with understanding and improving our existing system. However, I definitely intend to review the alternatives (Strawberry, Tartiflette, Ariadne) in the near future in the hopes of finding one I like more than graphene, and adopting during an API re-write.

nrbnlulu commented 2 years ago

Good luck!