File tree Expand file tree Collapse file tree 2 files changed +32
-5
lines changed
Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ dev = [
3939 " pdoc3==0.9.1" ,
4040 " hatch" ,
4141]
42+
43+ [tool .hatch .build .targets .wheel ]
44+ packages = [" schemadiff" ]
Original file line number Diff line number Diff line change 88 is_interface_type ,
99)
1010
11- try :
12- from graphql .type .introspection import TypeResolvers
13- except ImportError :
14- from graphql .type .introspection import TypeFieldResolvers as TypeResolvers # graphql-core < 3.2.0
15-
1611from schemadiff .changes .directive import RemovedDirective , AddedDirective
1712from schemadiff .changes .schema import (
1813 SchemaQueryTypeChanged ,
3227from schemadiff .diff .union_type import UnionType
3328from schemadiff .diff .input_object_type import InputObjectType
3429
30+ def _get_type_resolvers ():
31+ """Get TypeResolvers/TypeFields with fallback for different graphql-core versions."""
32+ # Try modern graphql-core (>= 3.2.7) - TypeFields is the official replacement
33+ try :
34+ from graphql .type .introspection import TypeFields
35+ return TypeFields
36+ except ImportError :
37+ pass
38+
39+ # Try graphql-core 3.2.0 - 3.2.6
40+ try :
41+ from graphql .type .introspection import TypeResolvers
42+ return TypeResolvers
43+ except ImportError :
44+ pass
45+
46+ # Fallback for older graphql-core (< 3.2.0)
47+ try :
48+ from graphql .type .introspection import TypeFieldResolvers
49+ return TypeFieldResolvers
50+ except ImportError :
51+ raise ImportError (
52+ "Could not import TypeFields, TypeResolvers, or TypeFieldResolvers from graphql-core. "
53+ "Please upgrade to a supported version of graphql-core."
54+ )
55+
56+
57+ TypeResolvers = _get_type_resolvers ()
58+
3559type_kind = partial (TypeResolvers .kind , _info = {})
3660
3761
You can’t perform that action at this time.
0 commit comments