mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 12:44:15 +03:00
Add get_underlying_type function
This commit is contained in:
parent
3cc1875e7a
commit
d933e04b04
|
@ -41,3 +41,10 @@ def get_type(_type):
|
||||||
if inspect.isfunction(_type) or isinstance(_type, partial):
|
if inspect.isfunction(_type) or isinstance(_type, partial):
|
||||||
return _type()
|
return _type()
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user