Skip to content

Commit 61bb5a5

Browse files
authored
Merge pull request #30 from gary-liguoliang/master
support more str based pydantic types
2 parents 40f1a67 + 75c59ed commit 61bb5a5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graphene_pydantic/converters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def convert_pydantic_type(
123123
# TODO: _should_ Sets remain here?
124124
return List(graphene_type)
125125
elif field.shape in SHAPE_MAPPING:
126-
raise ConversionError(f"Don't know how to handle mappings in Graphene.")
126+
raise ConversionError("Don't know how to handle mappings in Graphene.")
127127

128128

129129
def find_graphene_type(
@@ -193,6 +193,8 @@ def find_graphene_type(
193193
)
194194
elif issubclass(type_, enum.Enum):
195195
return Enum.from_enum(type_)
196+
elif issubclass(type_, str):
197+
return String
196198
else:
197199
raise ConversionError(
198200
f"Don't know how to convert the Pydantic field {field!r} ({field.type_})"

0 commit comments

Comments
 (0)