Add get_underlying_type function

This commit is contained in:
Jonathan Kim 2020-06-27 14:21:24 +01:00
parent 3cc1875e7a
commit d933e04b04

View File

@ -41,3 +41,10 @@ def get_type(_type):
if inspect.isfunction(_type) or isinstance(_type, partial):
return _type()
return _type
def get_underlying_type(_type):
"""Get the underlying type even if it is wrapped in structures like NonNull"""
while hasattr(_type, "of_type"):
_type = _type.of_type
return _type