From c0574627474ac74b20673bb10064e98866560162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20P=C5=99=C3=ADhoda?= Date: Tue, 30 Mar 2021 13:49:00 +0200 Subject: [PATCH] Increase warning visibility, suggest using field metadata (#130) --- marshmallow_dataclass/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/marshmallow_dataclass/__init__.py b/marshmallow_dataclass/__init__.py index 5dd6ec6..1e29738 100644 --- a/marshmallow_dataclass/__init__.py +++ b/marshmallow_dataclass/__init__.py @@ -326,12 +326,14 @@ def _internal_class_schema( except TypeError: # Not a dataclass try: warnings.warn( + f"****** WARNING ****** " f"marshmallow_dataclass was called on the class {clazz}, which is not a dataclass. " f"It is going to try and convert the class into a dataclass, which may have " f"undesirable side effects. To avoid this message, make sure all your classes and " f"all the classes of their fields are either explicitly supported by " - f"marshmallow_datcalass, or are already dataclasses. For more information, see " - f"https://github.com/lovasoa/marshmallow_dataclass/issues/51" + f"marshmallow_dataclass, or define the schema explicitly using field(metadata=dict(marshmallow_field=...)). For more information, see " + f"https://github.com/lovasoa/marshmallow_dataclass/issues/51 " + f"****** WARNING ******" ) created_dataclass: type = dataclasses.dataclass(clazz) return _internal_class_schema(created_dataclass, base_schema)