diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 71e6973..8fb48bc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog --------- +1.1.1 (unreleased) +++++++++++++++++++ + +Bug fixes: + +* Fix compatibility with marshmallow 3.24.0 and 4.0.0. + 1.1.0 (2024-08-14) ++++++++++++++++++ diff --git a/src/marshmallow_sqlalchemy/convert.py b/src/marshmallow_sqlalchemy/convert.py index 81458da..6cfac83 100644 --- a/src/marshmallow_sqlalchemy/convert.py +++ b/src/marshmallow_sqlalchemy/convert.py @@ -43,7 +43,7 @@ def _postgres_array_factory(converter, data_type): def _enum_field_factory(converter, data_type): - return fields.Enum if data_type.enum_class else fields.Field + return fields.Enum if data_type.enum_class else fields.Raw def _field_update_kwargs(field_class, field_kwargs, kwargs): @@ -57,7 +57,7 @@ def _field_update_kwargs(field_class, field_kwargs, kwargs): possible_field_keywords = { key for cls in inspect.getmro(field_class) - for key, param in inspect.signature(cls).parameters.items() + for key, param in inspect.signature(cls.__init__).parameters.items() if param.kind is inspect.Parameter.POSITIONAL_OR_KEYWORD or param.kind is inspect.Parameter.KEYWORD_ONLY } @@ -305,7 +305,7 @@ def _add_column_kwargs(self, kwargs, column): if hasattr(column.type, "enums") and not kwargs.get("dump_only"): kwargs["validate"].append(validate.OneOf(choices=column.type.enums)) - if hasattr(column.type, "enum_class"): + if hasattr(column.type, "enum_class") and column.type.enum_class is not None: kwargs["enum"] = column.type.enum_class # Add a length validator if a max length is set on the column