From 24cc880034eb8c695bd81bdf592a5b8da0a07079 Mon Sep 17 00:00:00 2001 From: ethilty Date: Sat, 1 Jan 2022 12:47:07 -0600 Subject: [PATCH] Fix for https://github.com/graphql-python/graphene-mongo/issues/162 --- graphene_mongo/fields.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/graphene_mongo/fields.py b/graphene_mongo/fields.py index 610325e8..08542ff1 100644 --- a/graphene_mongo/fields.py +++ b/graphene_mongo/fields.py @@ -121,11 +121,13 @@ def is_filterable(k): ), ): return False - if getattr(converted, "type", None) and getattr(converted.type, "_of_type", None) and issubclass( - (get_type(converted.type.of_type)), graphene.Union): + + # Fix for https://github.com/graphql-python/graphene-mongo/issues/162 + if getattr(converted, "type", None) and getattr(converted.type, "_of_type", None) and not issubclass( + (get_type(converted.type.of_type)), graphene.Scalar): return False - if isinstance(converted, (graphene.List)) and issubclass( - getattr(converted, "_of_type", None), graphene.Union + if isinstance(converted, (graphene.List)) and not issubclass( + getattr(converted, "_of_type", None), graphene.Scalar ): return False return True