diff --git a/ariadne_graphql_proxy/unwrap_type.py b/ariadne_graphql_proxy/unwrap_type.py new file mode 100644 index 0000000..d27f7a0 --- /dev/null +++ b/ariadne_graphql_proxy/unwrap_type.py @@ -0,0 +1,14 @@ +from typing import cast + +from graphql import ( + GraphQLType, + GraphQLNamedType, + GraphQLWrappingType, +) + + +def unwrap_graphql_type(type_: GraphQLType) -> GraphQLNamedType: + if isinstance(type_, GraphQLWrappingType): + return unwrap_graphql_type(type_.of_type) + + return cast(GraphQLNamedType, type_)