Skip to content

Commit dbd909f

Browse files
committed
Add warning when multiple Field annotations have bene detected
1 parent c19b563 commit dbd909f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

marshmallow_dataclass/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,11 @@ def _field_for_annotated_type(
733733
or isinstance(arg, marshmallow.fields.Field)
734734
]
735735
if marshmallow_annotations:
736+
if len(marshmallow_annotations) > 1:
737+
warnings.warn(
738+
"Multiple marshmallow Field annotations found. Using the last one."
739+
)
740+
736741
field = marshmallow_annotations[-1]
737742
# Got a field instance, return as is. User must know what they're doing
738743
if isinstance(field, marshmallow.fields.Field):

0 commit comments

Comments
 (0)