Skip to content

Commit 4f54555

Browse files
🔁 Fix TypeFieldResolvers ImportError with graphql-core==3.2.0 (Ambro17#22)
* Fix for graphql-core==3.2.0 * Make code compatible with graphql-core < 3.2.0 Do not force clients to update graphql-code * Specify ImportError
1 parent d1c5749 commit 4f54555

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

schemadiff/diff/schema.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
is_object_type,
88
is_interface_type,
99
)
10-
from graphql.type.introspection import TypeFieldResolvers
10+
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
1115

1216
from schemadiff.changes.directive import RemovedDirective, AddedDirective
1317
from schemadiff.changes.schema import (
@@ -28,7 +32,7 @@
2832
from schemadiff.diff.union_type import UnionType
2933
from schemadiff.diff.input_object_type import InputObjectType
3034

31-
type_kind = partial(TypeFieldResolvers.kind, _info={})
35+
type_kind = partial(TypeResolvers.kind, _info={})
3236

3337

3438
class Schema:

0 commit comments

Comments
 (0)