Skip to content

Commit 886131c

Browse files
committed
set name field if only specified manually
1 parent 8992b26 commit 886131c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graphene_pydantic/converters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def convert_pydantic_field(
125125
)
126126
field_kwargs.setdefault("required", field.required)
127127
field_kwargs.setdefault("default_value", field.default)
128-
field_kwargs.setdefault("name", field.alias)
128+
if field.has_alias:
129+
field_kwargs.setdefault("name", field.alias)
129130
# TODO: find a better way to get a field's description. Some ideas include:
130131
# - hunt down the description from the field's schema, or the schema
131132
# from the field's base model

0 commit comments

Comments
 (0)