You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to return Null/None in a custom Scalar type #255
But it appears this issue isn't gonna be fixed until graphql-core-next is released. Ive attempted to install the next alpha version along with graphene-django but it seems unhappy. (Are they currently incompatible)?
# Allow None to be returned in type serialiser
from graphql.execution import executor
def patched_complete_leaf_value(return_type, path, result):
assert hasattr(return_type, "serialize"), "Missing serialize method on type"
serialized_result = return_type.serialize(result)
return serialized_result
executor.complete_leaf_value = patched_complete_leaf_value
Activity
McPo commentedon Sep 10, 2019
Ended up having to monkey patch it
McPo commentedon Sep 10, 2019
Also regarding graphene-django and django-core v3. I just saw this post graphql-python/graphene-django#705
Looks like it will be coming in the near future.
McPo commentedon Sep 17, 2019
Another way to do it is in the resolver thats passed to the field. No monkey patch required.