Skip to content

Commit e163bd7

Browse files
committed
Correctly identify BaseModels or subclasses thereof
1 parent a59aa31 commit e163bd7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

graphene_pydantic/converters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import collections.abc
33
import datetime
44
import decimal
5+
import inspect
56
import enum
67
import sys
78
import typing as T
@@ -199,7 +200,10 @@ def find_graphene_type(
199200
return List
200201
elif registry and registry.get_type_for_model(type_):
201202
return registry.get_type_for_model(type_)
202-
elif registry and isinstance(type_, BaseModel):
203+
elif registry and (
204+
isinstance(type_, BaseModel)
205+
or (inspect.isclass(type_) and issubclass(type_, BaseModel))
206+
):
203207
# If it's a Pydantic model that hasn't yet been wrapped with a ObjectType,
204208
# we can put a placeholder in and request that `resolve_placeholders()`
205209
# be called to update it.

0 commit comments

Comments
 (0)