NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #299 most downloaded on PyPI
A lightweight library for converting complex datatypes to and from native Python datatypes.
Last release 1 months ago
08 Aug 2026
Release timing varies
gaps range from 8 days to 4 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
201 releases · first in 2013
Prevent TypeError when a non-collection is passed to a Schema with many=True. Instead, raise ValidationError with {'_schema': ['Invalid input type.']}
Bug fixes:
Prevent TypeError when a non-collection is passed to a Schema with many=True. Instead, raise ValidationError with {'_schema': ['Invalid input type.']} (906).
Fix root attribute for nested container fields on list on inheriting schemas (956). Thanks bmcbu for reporting.
These fixes were backported from 3.0.0b15 and 3.0.0b16.
Handle empty SQLAlchemy lazy lists gracefully when dumping (948). Thanks vke-code for the catch and YuriHeupa for the patch.
Bug fixes:
Handle empty SQLAlchemy lazy lists gracefully when dumping (948). Thanks vke-code for the catch and YuriHeupa for the patch.
One column per quarter.
Bug fixes:
Handle empty SQLAlchemy lazy lists gracefully when dumping ( #948 ). Thanks @vke-code for the catch and @YuriHeupa for the patch.
Respect load_from when reporting errors for @validates('field_name') (748). Thanks m-novikov for the catch and patch.
Bug fixes:
Respect load_from when reporting errors for @validates('field_name') (748). Thanks m-novikov for the catch and patch.
Bug fixes:
Respect load_from when reporting errors for @validates('field_name') ( #748 ). Thanks @m-novikov for the catch and patch.
Fix passing only as a string to nested when the passed field defines dump_to (800, 822). Thanks deckar01 for the catch and patch.
Bug fixes:
Fix passing only as a string to nested when the passed field defines dump_to (800, 822). Thanks deckar01 for the catch and patch.
Fix a race condition in validation when concurrent threads use the same Schema instance (783). Thanks yupeng0921 and lafrech for the fix.
Bug fixes:
Fix a race condition in validation when concurrent threads use the same Schema instance (783). Thanks yupeng0921 and lafrech for the fix.
Fix serialization behavior of fields.List(fields.Integer(as_string=True)) (788). Thanks cactus for reporting and lafrech for the fix.
Fix behavior of exclude parameter when passed from parent to nested schemas (728). Thanks timc13 for reporting and deckar01 for the fix.
Bug fixes:
Fix a race condition in validation when concurrent threads use the same Schema instance ( #783 ). Thanks @yupeng0921 and @lafrech for the fix.
Fix serialization behavior of fields.List(fields.Integer(as_string=True)) ( #788 ). Thanks @cactus for reporting and @lafrech for the fix.
Fix behavior of exclude parameter when passed from parent to nested schemas ( #728 ). Thanks @timc13 for reporting and @deckar01 for the fix.
2018-17175: Fix behavior when an empty list is passed as the only argument (772). Thanks deckar01 for reporting and thanks lafrech for the fix.
Bug fixes:
2018-17175: Fix behavior when an empty list is passed as the only argument (772). Thanks deckar01 for reporting and thanks lafrech for the fix.
Bug fixes:
CVE 2018-17175 : Fix behavior when an empty list is passed as the only argument ( #772 ). Thanks @deckar01 for reporting and thanks @lafrech for the fix.
Handle UnicodeDecodeError when deserializing bytes with a String field (650). Thanks dan-blanchard for the suggestion and thanks 4lissonsilveira for t
Bug fixes:
Handle UnicodeDecodeError when deserializing bytes with a String field (650). Thanks dan-blanchard for the suggestion and thanks 4lissonsilveira for the PR.
Bug fixes:
Handle UnicodeDecodeError when deserializing bytes with a String field ( #650 ). Thanks @dan-blanchard for the suggestion and thanks @4lissonsilveira for the PR.
Add require_tld parameter to validate.URL (664). Thanks sduthil for the suggestion and the PR.
Features:
Add require_tld parameter to validate.URL (664). Thanks sduthil for the suggestion and the PR.
Features:
Add require_tld parameter to validate.URL ( #664 ). Thanks @sduthil for the suggestion and the PR.
Fix serialization of types that implement __getitem__ (669). Thanks MichalKononenko.
Bug fixes:
Fix serialization of types that implement __getitem__ (669). Thanks MichalKononenko.
Fix validation of iso8601-formatted dates (556). Thanks lafrech for reporting.
Bug fixes:
Fix validation of iso8601-formatted dates (556). Thanks lafrech for reporting.
Bug fixes:
Fix validation of iso8601-formatted dates ( #556 ). Thanks @lafrech for reporting.
Fix symmetry of serialization and deserialization behavior when passing a dot-delimited path to the attribute parameter of fields (450). Thanks itajaj
Bug fixes:
Fix symmetry of serialization and deserialization behavior when passing a dot-delimited path to the attribute parameter of fields (450). Thanks itajaja for reporting.
Restore backwards-compatibility of SchemaOpts constructor (597). Thanks Wesmania for reporting and thanks frol for the fix.
Bug fixes:
Restore backwards-compatibility of SchemaOpts constructor (597). Thanks Wesmania for reporting and thanks frol for the fix.
Bug fixes:
Restore backwards-compatibility of SchemaOpts constructor ( #597 ). Thanks @Wesmania for reporting and thanks @frol for the fix.
Fix inheritance of ordered option when Schema subclasses define class Meta (593). Thanks frol.
Bug fixes:
Fix inheritance of ordered option when Schema subclasses define class Meta (593). Thanks frol.
Support:
Update contributing docs.
Bug fixes:
Fix inheritance of ordered option when Schema subclasses define class Meta ( #593 ). Thanks @frol .
Support:
Update contributing docs.
Fix sorting on Schema subclasses when ordered=True (592). Thanks frol.
Bug fixes:
Fix sorting on Schema subclasses when ordered=True (592). Thanks frol.
Minor optimizations (577). Thanks rowillia for the PR.
Features:
Minor optimizations (577). Thanks rowillia for the PR.
Unbound fields return None rather returning the field itself. This fixes a corner case introduced in 572. Thanks touilleMan for reporting and YuriHeup
Bug fixes:
Unbound fields return None rather returning the field itself. This fixes a corner case introduced in 572. Thanks touilleMan for reporting and YuriHeupa for the fix.
Bug fixes:
Unbound fields return None rather returning the field itself. This fixes a corner case introduced in #572 . Thanks @touilleMan for reporting and @YuriHeupa for the fix.
Fix behavior when a Nested field is composed within a List field (572). Thanks avish for reporting and YuriHeupa for the PR.
Bug fixes:
Fix behavior when a Nested field is composed within a List field (572). Thanks avish for reporting and YuriHeupa for the PR.
Bug fixes:
Fix behavior when a Nested field is composed within a List field ( #572 ). Thanks @avish for reporting and @YuriHeupa for the PR.
Allow passing nested attributes (e.g. 'child.field') to the dump_only and load_only parameters of Schema (572). Thanks YuriHeupa for the PR.
Features:
Allow passing nested attributes (e.g. 'child.field') to the dump_only and load_only parameters of Schema (572). Thanks YuriHeupa for the PR.
Add schemes parameter to fields.URL (574). Thanks mosquito for the PR.
Allow strict class Meta option to be overridden by constructor (550). Thanks douglas-treadwell for reporting and thanks podhmo for the PR.
Bug fixes:
Allow strict class Meta option to be overridden by constructor (550). Thanks douglas-treadwell for reporting and thanks podhmo for the PR.
Bug fixes:
Allow strict class Meta option to be overridden by constructor ( #550 ). Thanks @douglas-treadwell for reporting and thanks @podhmo for the PR.
Import marshmallow.fields in marshmallow/__init__.py to save an import when importing the marshmallow module (557). Thanks mindojo-victor.
Features:
Import marshmallow.fields in marshmallow/__init__.py to save an import when importing the marshmallow module (557). Thanks mindojo-victor.
Support:
Documentation: Improve example in "Validating Original Input Data" (558). Thanks altaurog.
Test against Python 3.6.
Features:
Import marshmallow.fields in marshmallow/init.py to save an import when importing the marshmallow module ( #557 ). Thanks @mindojo-victor .
Support:
Documentation: Improve example in “Validating Original Input Data” ( #558 ). Thanks @altaurog .
Test against Python 3.6.
Reset user-defined kwargs passed to ValidationError on each Schema.load call (565). Thanks jbasko for the catch and patch.
Bug fixes:
Reset user-defined kwargs passed to ValidationError on each Schema.load call (565). Thanks jbasko for the catch and patch.
Support:
Tests: Fix redefinition of test_utils.test_get_value() (562). Thanks nelfin.
Function field works with callables that use Python 3 type annotations (540). Thanks martinstein for reporting and thanks sabinem, lafrech, and maximk
Bug fixes:
Function field works with callables that use Python 3 type annotations (540). Thanks martinstein for reporting and thanks sabinem, lafrech, and maximkulkin for the work on the PR.
Bug fixes:
Function field works with callables that use Python 3 type annotations ( #540 ). Thanks @martinstein for reporting and thanks @sabinem , @lafrech , and @maximkulkin for the work on the PR.
Fix behavior for serializing missing data with Number fields when as_string=True is passed (538). Thanks jessemyers for reporting.
Bug fixes:
Fix behavior for serializing missing data with Number fields when as_string=True is passed (538). Thanks jessemyers for reporting.
Bug fixes:
Fix behavior for serializing missing data with Number fields when as_string=True is passed ( #538 ). Thanks @jessemyers for reporting.
Use fixed-point notation rather than engineering notation when serializing with Decimal (534). Thanks gdub.
Bug fixes:
Use fixed-point notation rather than engineering notation when serializing with Decimal (534). Thanks gdub.
Fix UUID validation on serialization and deserialization of uuid.UUID objects (532). Thanks pauljz.
Fix behavior when using validate.Equal(False) (484). Thanks pktangyue for reporting and thanks tuukkamustonen for the fix.
Bug fixes:
Fix behavior when using validate.Equal(False) (484). Thanks pktangyue for reporting and thanks tuukkamustonen for the fix.
Fix strict behavior when errors are raised in pre_dump/post_dump processors (521). Thanks tvuotila for the catch and patch.
Fix validation of nested fields on dumping (528). Thanks again tvuotila.
Bug fixes:
Fix behavior when using validate.Equal(False) ( #484 ). Thanks @pktangyue for reporting and thanks @tuukkamustonen for the fix.
Fix strict behavior when errors are raised in pre_dump / post_dump processors ( #521 ). Thanks @tvuotila for the catch and patch.
Fix validation of nested fields on dumping ( #528 ). Thanks again @tvuotila .
Errors raised by pre/post-load/dump methods will be added to a schema's errors dictionary (472). Thanks dbertouille for the suggestion and for the PR.
Features:
Errors raised by pre/post-load/dump methods will be added to a schema's errors dictionary (472). Thanks dbertouille for the suggestion and for the PR.
Fix serialization of datetime.time objects with microseconds (464). Thanks Tim-Erwin for reporting and thanks vuonghv for the fix.
Bug fixes:
Fix serialization of datetime.time objects with microseconds (464). Thanks Tim-Erwin for reporting and thanks vuonghv for the fix.
Make @validates consistent with field validator behavior: if validation fails, the field will not be included in the deserialized output (391). Thanks martinstein for reporting and thanks vuonghv for the fix.
Bug fixes:
Fix serialization of datetime.time objects with microseconds ( #464 ). Thanks @Tim-Erwin for reporting and thanks @vuonghv for the fix.
Make @validates consistent with field validator behavior: if validation fails, the field will not be included in the deserialized output ( #391 ). Thanks @martinstein for reporting and thanks @vuonghv for the fix.
Decimal field coerces input values to a string before deserializing to a decimal.Decimal object in order to avoid transformation of float values under
Decimal field coerces input values to a string before deserializing to a decimal.Decimal object in order to avoid transformation of float values under 12 significant digits (434, 435). Thanks davidthornton for the PR.
Allow only and exclude parameters to take nested fields, using dot-delimited syntax (e.g. only=['blog.author.email']) (402). Thanks Tim-Erwin and deck
Features:
Allow only and exclude parameters to take nested fields, using dot-delimited syntax (e.g. only=['blog.author.email']) (402). Thanks Tim-Erwin and deckar01 for the discussion and implementation.
Support:
Update tasks.py for compatibility with invoke>=0.13.0. Thanks deckar01.
Make field.parent and field.name accessible to on_bind_field (449). Thanks immerrr.
Make field.parent and field.name accessible to on_bind_field (449). Thanks immerrr.
No code changes in this release. This is a reupload in order to distribute an sdist for the last hotfix release. See 443.
No code changes in this release. This is a reupload in order to distribute an sdist for the last hotfix release. See 443.
Support:
Update license entry in setup.py to fix RPM distributions (433). Thanks rrajaravi for reporting.
Only add Schemas to class registry if a class name is provided. This allows Schemas to be constructed dynamically using the type constructor without g
Bug fixes:
Only add Schemas to class registry if a class name is provided. This allows Schemas to be constructed dynamically using the type constructor without getting added to the class registry (which is useful for saving memory).
Make context available to Nested field's on_bind_field method (408). Thanks immerrr for the PR.
Features:
Make context available to Nested field's on_bind_field method (408). Thanks immerrr for the PR.
Pass through user ValidationError kwargs (418). Thanks russelldavies for helping implement this.
Other changes:
Remove unused attributes root, parent, and name from SchemaABC (410). Thanks Tim-Erwin for the PR.
Features:
Make context available to Nested field’s on_bind_field method ( #408 ). Thanks @immerrr for the PR.
Pass through user ValidationError kwargs ( #418 ). Thanks @russelldavies for helping implement this.
Other changes:
Remove unused attributes root , parent , and name from SchemaABC ( #410 ). Thanks @Tim-Erwin for the PR.
Respect load_from when reporting errors for nested required fields (414). Thanks yumike.
Bug fixes:
Respect load_from when reporting errors for nested required fields (414). Thanks yumike.
Add partial argument to Schema.validate (379). Thanks tdevelioglu for the PR.
Features:
Add partial argument to Schema.validate (379). Thanks tdevelioglu for the PR.
Add equal argument to validate.Length. Thanks daniloakamine.
Collect all validation errors for each item deserialized by a List field (345). Thanks maximkulkin for the report and the PR.
Features:
Add partial argument to Schema.validate ( #379 ). Thanks @tdevelioglu for the PR.
Add equal argument to validate.Length . Thanks @daniloakamine .
Collect all validation errors for each item deserialized by a List field ( #345 ). Thanks @maximkulkin for the report and the PR.
Allow a tuple of field names to be passed as the partial argument to Schema.load (369). Thanks tdevelioglu for the PR.
Features:
Allow a tuple of field names to be passed as the partial argument to Schema.load (369). Thanks tdevelioglu for the PR.
Add schemes argument to validate.URL (356).
Prevent duplicate error messages when validating nested collections (360). Thanks alexmorken for the catch and patch.
Bug fixes:
Prevent duplicate error messages when validating nested collections (360). Thanks alexmorken for the catch and patch.
Bug fixes:
Prevent duplicate error messages when validating nested collections ( #360 ). Thanks @alexmorken for the catch and patch.
Serializing an iterator will not drop the first item (343, 353). Thanks jmcarp for the patch. Thanks edgarallang and jmcarp for reporting.
Bug fixes:
Serializing an iterator will not drop the first item (343, 353). Thanks jmcarp for the patch. Thanks edgarallang and jmcarp for reporting.
Bug fixes:
Serializing an iterator will not drop the first item ( #343 , #353 ). Thanks @jmcarp for the patch. Thanks @edgarallang and @jmcarp for reporting.
Add skip_on_field_errors parameter to validates_schema (323). Thanks jjvattamattom for the suggestion and d-sutherland for the PR.
Features:
Add skip_on_field_errors parameter to validates_schema (323). Thanks jjvattamattom for the suggestion and d-sutherland for the PR.
Bug fixes:
Fix FormattedString serialization (348). Thanks acaird for reporting.
Fix @validates behavior when used when attribute is specified and strict=True (350). Thanks density for reporting.
Features:
Add skip_on_field_errors parameter to validates_schema ( #323 ). Thanks @jjvattamattom for the suggestion and @d-sutherland for the PR.
Bug fixes:
Fix FormattedString serialization ( #348 ). Thanks @acaird for reporting.
Fix @validates behavior when used when attribute is specified and strict=True ( #350 ). Thanks @density for reporting.
Add dump_to parameter to fields (310). Thanks ShayanArmanPercolate for the suggestion. Thanks franciscod and ewang for the PRs.
Features:
Add dump_to parameter to fields (310). Thanks ShayanArmanPercolate for the suggestion. Thanks franciscod and ewang for the PRs.
The deserialize function passed to fields.Function can optionally receive a context argument (324). Thanks DamianHeard.
The serialize function passed to fields.Function is optional (325). Thanks again DamianHeard.
The serialize function passed to fields.Method is optional (329). Thanks justanr.
Deprecation/Removal:
The func argument of fields.Function has been renamed to serialize.
The method_name argument of fields.Method has been renamed to serialize.
func and method_name are still present for backwards-compatibility, but they will both be removed in marshmallow 3.0.
Features:
Add dump_to parameter to fields ( #310 ). Thanks @ShayanArmanPercolate for the suggestion. Thanks @franciscod and @ewang for the PRs.
The deserialize function passed to fields.Function can optionally receive a context argument ( #324 ). Thanks @DamianHeard .
The serialize function passed to fields.Function is optional ( #325 ). Thanks again @DamianHeard .
The serialize function passed to fields.Method is optional ( #329 ). Thanks @justanr .
Deprecation/Removal:
The func argument of fields.Function has been renamed to serialize .
The method_name argument of fields.Method has been renamed to serialize .
func and method_name are still present for backwards-compatibility, but they will both be removed in marshmallow 3.0.
Skip field validators for fields that aren't included in only (320). Thanks carlos-alberto for reporting and eprikazc for the PR.
Bug fixes:
Skip field validators for fields that aren't included in only (320). Thanks carlos-alberto for reporting and eprikazc for the PR.
Bug fixes:
Skip field validators for fields that aren’t included in only ( #320 ). Thanks @carlos-alberto for reporting and @eprikazc for the PR.
Add support for partial deserialization with the partial argument to Schema and Schema.load (290). Thanks taion.
Features:
Add support for partial deserialization with the partial argument to Schema and Schema.load (290). Thanks taion.
Deprecation/Removals:
Query and QuerySelect fields are removed.
Passing of strings to required and allow_none is removed. Pass the error_messages argument instead.
Support:
Add example of Schema inheritance in docs (225). Thanks martinstein for the suggestion and juanrossi for the PR.
Add "Customizing Error Messages" section to custom fields docs.
Fix serialization of collections for which iter will modify position, e.g. Pymongo cursors (303). Thanks Mise for the catch and patch.
Bug fixes:
Fix serialization of collections for which iter will modify position, e.g. Pymongo cursors (303). Thanks Mise for the catch and patch.
Fix passing data to schema validator when using @validates_schema(many=True) (297). Thanks d-sutherland for reporting.
Bug fixes:
Fix passing data to schema validator when using @validates_schema(many=True) (297). Thanks d-sutherland for reporting.
Fix usage of @validates with a nested field when many=True (298). Thanks nelfin for the catch and patch.
Bug fixes:
Fix passing data to schema validator when using @validates_schema(many=True) ( #297 ). Thanks @d-sutherland for reporting.
Fix usage of @validates with a nested field when many=True ( #298 ). Thanks @nelfin for the catch and patch.
Constant field deserializes to its value regardless of whether its field name is present in input data (291). Thanks fayazkhan for reporting.
Bug fixes:
Constant field deserializes to its value regardless of whether its field name is present in input data (291). Thanks fayazkhan for reporting.
The extra param of Schema is deprecated. Add extra data in a post_load method instead.
Features:
Add Dict field for arbitrary mapping data (251). Thanks dwieeb for adding this and Dowwie for the suggestion.
Add Field.root property, which references the field's Schema.
Deprecation/Removals:
The extra param of Schema is deprecated. Add extra data in a post_load method instead.
UnmarshallingError and MarshallingError are removed.
Bug fixes:
Fix storing multiple schema-level validation errors (287). Thanks evgeny-sureev for the patch.
If missing=None on a field, allow_none will be set to True.
Other changes:
A List's inner field will have the list field set as its parent. Use root to access the Schema.
Passing string arguments to required and allow_none is deprecated. Pass the error_messages argument instead. This API will be removed in version 2.2.
Features:
Make error messages configurable at the class level and instance level (Field.default_error_messages attribute and error_messages parameter, respectively).
Deprecation/Removals:
Remove make_object. Use a post_load method instead (277).
Remove the error parameter and attribute of Field.
Passing string arguments to required and allow_none is deprecated. Pass the error_messages argument instead. This API will be removed in version 2.2.
Remove Arbitrary, Fixed, and Price fields (86). Use Decimal instead.
Remove Select / Enum fields (135). Use the OneOf validator instead.
Bug fixes:
Fix error format for Nested fields when many=True. Thanks alexmorken.
pre_dump methods are invoked before implicit field creation. Thanks makmanalp for reporting.
Return correct "required" error message for Nested field.
The only argument passed to a Schema is bounded by the fields option (183). Thanks lustdante for the suggestion.
Changes from 2.0.0rc2:
error_handler and accessor options are replaced with the handle_error and get_attribute methods 284.
Remove marshmallow.compat.plain_function since it is no longer used.
Non-collection values are invalid input for List field (231). Thanks density for reporting.
Bug fix: Prevent infinite loop when validating a required, self-nested field. Thanks Bachmann1234 for the fix.
make_object is deprecated. Use a post_load method instead (277). This method will be removed in the final 2.0 release.
Deprecation/Removals:
make_object is deprecated. Use a post_load method instead (277). This method will be removed in the final 2.0 release.
Schema.accessor and Schema.error_handler decorators are deprecated. Define the accessor and error_handler class Meta options instead.
Bug fixes:
Allow non-field names to be passed to ValidationError (273). Thanks evgeny-sureev for the catch and patch.
Changes from 2.0.0rc1:
The raw parameter of the pre_*, post_*, validates_schema decorators was renamed to pass_many (276).
Add pass_original parameter to post_load and post_dump (216).
Methods decorated with the pre_*, post_*, and validates_* decorators must be instance methods. Class methods and instance methods are not supported at this time.
QuerySelect and QuerySelectList are deprecated (227). These fields will be removed in version 2.1.
Features:
Backwards-incompatible: fields.Field._deserialize now takes attr and data as arguments (172). Thanks alexmic and kevinastone for the suggestion.
Allow a Field's attribute to be modified during deserialization (266). Thanks floqqi.
Allow partially-valid data to be returned for Nested fields (269). Thanks jomag for the suggestion.
Add Schema.on_bind_field hook which allows a Schema to modify its fields when they are bound.
Stricter validation of string, boolean, and number fields (231). Thanks touilleMan for the suggestion.
Improve consistency of error messages.
Deprecation/Removals:
Schema.validator, Schema.preprocessor, and Schema.data_handler are removed. Use validates_schema, pre_load, and post_dump instead.
QuerySelect and QuerySelectList are deprecated (227). These fields will be removed in version 2.1.
utils.get_callable_name is removed.
Bug fixes:
If a date format string is passed to a DateTime field, it is always used for deserialization (248). Thanks bartaelterman and praveen-p.
Support:
Documentation: Add "Using Context" section to "Extending Schemas" page (224).
Include tests and docs in release tarballs (201).
Test against Python 3.5.
If a field corresponds to a callable attribute, it will be called upon serialization. Thanks alexmorken.
Features:
If a field corresponds to a callable attribute, it will be called upon serialization. Thanks alexmorken.
Add load_only and dump_only class Meta options. Thanks kelvinhammond.
If a Nested field is required, recursively validate any required fields in the nested schema (235). Thanks max-orhai.
Improve error message if a list of dicts is not passed to a Nested field for which many=True. Thanks again max-orhai.
Bug fixes:
make_object is only called after all validators and postprocessors have finished (253). Thanks sunsongxp for reporting.
If an invalid type is passed to Schema and strict=False, store a _schema error in the errors dict rather than raise an exception (261). Thanks density for reporting.
Other changes:
make_object is only called when input data are completely valid (243). Thanks kissgyorgy for reporting.
Change default error messages for URL and Email validators so that they don't include user input (255).
Email validator permits email addresses with non-ASCII characters, as per RFC 6530 (221). Thanks lextoumbourou for reporting and mwstobo for sending the patch.
List field respects the attribute argument of the inner field. Thanks jmcarp.
Features:
List field respects the attribute argument of the inner field. Thanks jmcarp.
The container field List field has access to its parent Schema via its parent attribute. Thanks again jmcarp.
Deprecation/Removals:
Legacy validator functions have been removed (73). Use the class-based validators in marshmallow.validate instead.
Bug fixes:
fields.Nested correctly serializes nested sets (233). Thanks traut.
Changes from 2.0.0b3:
If load_from is used on deserialization, the value of load_from is used as the key in the errors dict (232). Thanks alexmorken.
Schema.validator is deprecated. Use marshmallow.validates_schema instead.
Features:
Add marshmallow.validates_schema decorator for defining schema-level validators (116).
Add marshmallow.validates decorator for defining field validators as Schema methods (116). Thanks philtay.
Performance improvements.
Defining __marshallable__ on complex objects is no longer necessary.
Add fields.Constant. Thanks kevinastone.
Deprecation/Removals:
Remove skip_missing class Meta option. By default, missing inputs are excluded from serialized output (211).
Remove optional context parameter that gets passed to methods for Method fields.
Schema.validator is deprecated. Use marshmallow.validates_schema instead.
utils.get_func_name is removed. Use utils.get_callable_name instead.
Bug fixes:
Fix serializing values from keyed tuple types (regression of 28). Thanks makmanalp for reporting.
Other changes:
Remove unnecessary call to utils.get_value for Function and Method fields (208). Thanks jmcarp.
Serializing a collection without passing many=True will not result in an error. Be very careful to pass the many argument when necessary.
Support:
Documentation: Update Flask and Peewee examples. Update Quickstart.
Changes from 2.0.0b2:
Boolean field serializes None to None, for consistency with other fields (213). Thanks cmanallen for reporting.
Bug fix: load_only fields do not get validated during serialization.
Implicit passing of original, raw data to Schema validators is removed. Use @marshmallow.validates_schema(pass_original=True) instead.
Add useful __repr__ methods to validators (204). Thanks philtay.
Features:
Add useful __repr__ methods to validators (204). Thanks philtay.
Backwards-incompatible: By default, NaN, Infinity, and -Infinity are invalid values for fields.Decimal. Pass allow_nan=True to allow these values. Thanks philtay.
Changes from 2.0.0b1:
Fix serialization of None for Time, TimeDelta, and Date fields (a regression introduced in 2.0.0a1).
Includes bug fixes from 1.2.6.
Errored fields will not appear in (de)serialized output dictionaries (153, 202).
Features:
Errored fields will not appear in (de)serialized output dictionaries (153, 202).
Instantiate OPTIONS_CLASS in SchemaMeta. This makes Schema.opts available in metaclass methods. It also causes validation to occur earlier (upon Schema class declaration rather than instantiation).
Add SchemaMeta.get_declared_fields class method to support adding additional declared fields.
Deprecation/Removals:
Remove allow_null parameter of fields.Nested (203).
Changes from 2.0.0a1:
Fix serialization of None for fields.Email.
MarshallingError and UnmarshallingError error are deprecated in favor of a single ValidationError (160).
Features:
Backwards-incompatible: When many=True, the errors dictionary returned by dump and load will be keyed on the indices of invalid items in the (de)serialized collection (75). Add index_errors=False on a Schema's class Meta options to disable this behavior.
Backwards-incompatible: By default, fields will raise a ValidationError if the input is None. The allow_none parameter can override this behavior.
Backwards-incompatible: A Field's default parameter is only used if explicitly set and the field's value is missing in the input to Schema.dump. If not set, the key will not be present in the serialized output for missing values . This is the behavior for all fields. fields.Str no longer defaults to '', fields.Int no longer defaults to 0, etc. (199). Thanks jmcarp for the feedback.
In strict mode, a ValidationError is raised. Error messages are accessed via the ValidationError's messages attribute (128).
Add allow_none parameter to fields.Field. If False (the default), validation fails when the field's value is None (76, 111). If allow_none is True, None is considered valid and will deserialize to None.
Schema-level validators can store error messages for multiple fields (118). Thanks ksesong for the suggestion.
Add pre_load, post_load, pre_dump, and post_dump Schema method decorators for defining pre- and post- processing routines (153, 179). Thanks davidism, taion, and jmcarp for the suggestions and feedback. Thanks taion for the implementation.
Error message for required validation is configurable. (78). Thanks svenstaro for the suggestion. Thanks 0xDCA for the implementation.
Add load_from parameter to fields (125). Thanks hakjoon.
Add load_only and dump_only parameters to fields (61, 87). Thanks philtay.
Add missing parameter to fields (115). Thanks philtay.
Schema validators can take an optional raw_data argument which contains raw input data, incl. data not specified in the schema (127). Thanks ryanlowe0.
Add validate.OneOf (135) and validate.ContainsOnly (149) validators. Thanks philtay.
Error messages for validators can be interpolated with {input} and other values (depending on the validator).
fields.TimeDelta always serializes to an integer value in order to avoid rounding errors (105). Thanks philtay.
Add include class Meta option to support field names which are Python keywords (139). Thanks nickretallack for the suggestion.
exclude parameter is respected when used together with only parameter (165). Thanks lustdante for the catch and patch.
fields.List works as expected with generators and sets (185). Thanks sergey-aganezov-jr.
Deprecation/Removals:
MarshallingError and UnmarshallingError error are deprecated in favor of a single ValidationError (160).
context argument passed to Method fields is deprecated. Use self.context instead (184).
Remove ForcedError.
Remove support for generator functions that yield validators (74). Plain generators of validators are still supported.
The Select/Enum field is deprecated in favor of using validate.OneOf validator (135).
Remove legacy, pre-1.0 API (Schema.data and Schema.errors properties) (73).
Remove null value.
Other changes:
Marshaller, Unmarshaller were moved to marshmallow.marshalling. These should be considered private API (129).
Make allow_null=True the default for Nested fields. This will make None serialize to None rather than a dictionary with empty values (132). Thanks nickrellack for the suggestion.
Fix validation error message for fields.Decimal.
Bug fixes:
Fix validation error message for fields.Decimal.
Allow error message for fields.Boolean to be customized with the error parameter (like other fields).
Fix validation of invalid types passed to a Nested field when many=True (188). Thanks juanrossi for reporting.
Bug fixes:
Fix validation of invalid types passed to a Nested field when many=True (188). Thanks juanrossi for reporting.
Support:
Fix pep8 dev dependency for flake8. Thanks taion.
Fix behavior of as_string on fields.Integer (173). Thanks taion for the catch and patch.
Bug fixes:
Fix behavior of as_string on fields.Integer (173). Thanks taion for the catch and patch.
Other changes:
Remove dead code from fields.Field. Thanks taion.
Support:
Correction to _postprocess method in docs. Thanks again taion.
Bug fixes:
Fix behavior of as_string on fields.Integer ( #173 ). Thanks @taion for the catch and patch.
Other changes:
Remove dead code from fields.Field . Thanks @taion .
Support:
Correction to _postprocess method in docs. Thanks again @taion .
Fix inheritance of ordered class Meta option (162). Thanks stephenfin for reporting.
Bug fixes:
Fix inheritance of ordered class Meta option (162). Thanks stephenfin for reporting.
Bug fixes:
Fix inheritance of ordered class Meta option ( #162 ). Thanks @stephenfin for reporting.
Fix behavior of skip_missing and accessor options when many=True (137). Thanks 3rdcycle.
Bug fixes:
Fix behavior of skip_missing and accessor options when many=True (137). Thanks 3rdcycle.
Fix bug that could cause an AttributeError when nesting schemas with schema-level validators (144). Thanks vovanbo for reporting.
Bug fixes:
Fix behavior of skip_missing and accessor options when many=True ( #137 ). Thanks @3rdcycle .
Fix bug that could cause an AttributeError when nesting schemas with schema-level validators ( #144 ). Thanks @vovanbo for reporting.
Your coding agent can read these notes before it upgrades. Set up the MCP server →