Open ShivanshJ opened 3 years ago
I tried the following -
class PostConnection(graphene.relay.Connection):
class Meta:
node = ProtectedPost
And the query becomes
class Query(graphene.ObjectType):
node = graphene.relay.Node.Field()
my_posts = graphene.relay.ConnectionField(ProtectedPost)
But then when auth Token is incorrect, the error message is :
"errors": [
{
"message": "Resolved value from the connection field have to be iterable or instance of PostConnection. Received \"<flask_graphql_auth.fields.AuthInfoField object at 0x1077adfa0>\"",
.
.
.
Can we simply not include GraphQLError in this library instead of using AuthInfoField. i.e,
from graphql.error.base import GraphQLError
func () {
.
return GraphQLError("Unauthenticated")
}
Can I raise a PR to replace all AuthInfoFields ?
I wanted to add Pagination with relay into my query.
The query fetches posts from user. The following is the working of
graphene.Union
- to include Authentication as given in the documentation.And the query is as follows:
However to add Pagination support, I have to add relay connection. So instead of using
graphene.List
, I have to useSQLAlchemyConnectionField
.my_posts = SQLAlchemyConnectionField(ProtectedPost).
But this gives the following error on starting the application :
SQLALchemyConnectionField only accepts SQLAlchemyObjectType types, not ProtectedPost
What to do if we want to include Relay ?