marshmallow 3.24.0__tar.gz → 3.24.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {marshmallow-3.24.0 → marshmallow-3.24.2}/CHANGELOG.rst +25 -3
- {marshmallow-3.24.0 → marshmallow-3.24.2}/PKG-INFO +1 -1
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/api_reference.rst +1 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/custom_fields.rst +2 -2
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/examples.rst +1 -3
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/extending.rst +4 -4
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/nesting.rst +1 -1
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/quickstart.rst +6 -8
- marshmallow-3.24.2/docs/top_level.rst +12 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/upgrading.rst +31 -31
- {marshmallow-3.24.0 → marshmallow-3.24.2}/pyproject.toml +1 -1
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/class_registry.py +2 -2
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/decorators.py +5 -5
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/fields.py +28 -36
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/schema.py +5 -5
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/utils.py +1 -1
- marshmallow-3.24.2/tests/mypy_test_cases/test_class_registry.py +4 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/CONTRIBUTING.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/LICENSE +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/NOTICE +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/README.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/SECURITY.md +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/.gitignore +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/_static/marshmallow-logo.png +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/_templates/donate.html +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/_templates/useful-links.html +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/about.rst.inc +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/authors.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/changelog.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/code_of_conduct.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/conf.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/contributing.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/dashing.json +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/ecosystem.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/index.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/install.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/kudos.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/license.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.class_registry.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.decorators.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.error_store.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.exceptions.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.fields.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.schema.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.utils.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/marshmallow.validate.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/whos_using.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/docs/why.rst +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/__init__.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/base.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/error_store.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/exceptions.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/orderedset.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/py.typed +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/types.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/validate.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/src/marshmallow/warnings.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/__init__.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/base.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/conftest.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/foo_serializer.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/mypy_test_cases/test_validation_error.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_decorators.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_deserialization.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_error_store.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_exceptions.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_fields.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_options.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_registry.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_schema.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_serialization.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_utils.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_validate.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tests/test_version_attributes.py +0 -0
- {marshmallow-3.24.0 → marshmallow-3.24.2}/tox.ini +0 -0
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
---------
|
|
3
3
|
|
|
4
|
+
3.24.2 (2025-01-08)
|
|
5
|
+
*******************
|
|
6
|
+
|
|
7
|
+
Changes:
|
|
8
|
+
|
|
9
|
+
- Don't override ``__new__`` to avoid breaking usages of `inspect.signature` with
|
|
10
|
+
`Field <marshmallow.fields.Field>` classes.
|
|
11
|
+
This allows marshmallow-sqlalchemy users to upgrade marshmallow without
|
|
12
|
+
upgrading to marshmallow-sqlalchemy>=1.1.1.
|
|
13
|
+
|
|
14
|
+
Documentation:
|
|
15
|
+
|
|
16
|
+
- Add top-level API back to docs (:issue:`2739`).
|
|
17
|
+
Thanks :user:`llucax` for reporting.
|
|
18
|
+
|
|
19
|
+
3.24.1 (2025-01-06)
|
|
20
|
+
*******************
|
|
21
|
+
|
|
22
|
+
Bug fixes:
|
|
23
|
+
|
|
24
|
+
- Typing: Fix typing for `class_registry.get_class <marshmallow.class_registry.get_class>` (:pr:`2735`).
|
|
25
|
+
|
|
4
26
|
3.24.0 (2025-01-06)
|
|
5
27
|
*******************
|
|
6
28
|
|
|
@@ -15,7 +37,7 @@ Bug fixes:
|
|
|
15
37
|
|
|
16
38
|
Deprecations:
|
|
17
39
|
|
|
18
|
-
- Custom validators should raise a `ValidationError <marshmallow.exceptions.ValidationError>` for invalid values.
|
|
40
|
+
- Custom validators should raise a `ValidationError <marshmallow.exceptions.ValidationError>` for invalid values.
|
|
19
41
|
Returning `False`` is no longer supported .
|
|
20
42
|
- Deprecate ``context`` parameter of `Schema <marshmallow.schema.Schema>` (:issue:`1826`).
|
|
21
43
|
Use `contextVars.ContextVar` to pass context data instead.
|
|
@@ -288,7 +310,7 @@ Bug fixes:
|
|
|
288
310
|
- Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change
|
|
289
311
|
introduced in 3.12.0 that causes issues when field names conflict with
|
|
290
312
|
``Schema`` attributes or methods. ``Fields``\s are still accessible on a
|
|
291
|
-
|
|
313
|
+
``Schema`` instance through the ``fields`` attribute. (:pr:`1843`)
|
|
292
314
|
|
|
293
315
|
3.12.1 (2021-05-10)
|
|
294
316
|
*******************
|
|
@@ -863,7 +885,7 @@ Bug fixes:
|
|
|
863
885
|
Other changes:
|
|
864
886
|
|
|
865
887
|
- *Backwards-incompatible*: ``_serialize`` and ``_deserialize`` methods of
|
|
866
|
-
all ``fields.Field`` subclasses must accept ``**kwargs`` (:pr:`1007`).
|
|
888
|
+
all ``fields.Field`` subclasses must accept ``**kwargs`` (:pr:`1007`).
|
|
867
889
|
|
|
868
890
|
|
|
869
891
|
3.0.0b18 (2018-10-15)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: marshmallow
|
|
3
|
-
Version: 3.24.
|
|
3
|
+
Version: 3.24.2
|
|
4
4
|
Summary: A lightweight library for converting complex datatypes to and from native Python datatypes.
|
|
5
5
|
Author-email: Steven Loria <sloria1@gmail.com>
|
|
6
6
|
Maintainer-email: Steven Loria <sloria1@gmail.com>, Jérôme Lafréchoux <jerome@jolimont.fr>, Jared Deckard <jared@shademaps.com>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Custom fields
|
|
2
2
|
=============
|
|
3
3
|
|
|
4
|
-
There are three ways to create a custom-formatted field for a `Schema
|
|
4
|
+
There are three ways to create a custom-formatted field for a `Schema <marshmallow.Schema>`:
|
|
5
5
|
|
|
6
6
|
- Create a custom :class:`Field <marshmallow.fields.Field>` class
|
|
7
7
|
- Use a :class:`Method <marshmallow.fields.Method>` field
|
|
@@ -101,7 +101,7 @@ Adding context to `Method` and `Function` fields
|
|
|
101
101
|
|
|
102
102
|
A :class:`Function <marshmallow.fields.Function>` or :class:`Method <marshmallow.fields.Method>` field may need information about its environment to know how to serialize a value.
|
|
103
103
|
|
|
104
|
-
In these cases, you can set the ``context`` attribute (a dictionary) of a `Schema
|
|
104
|
+
In these cases, you can set the ``context`` attribute (a dictionary) of a `Schema <marshmallow.Schema>`. :class:`Function <marshmallow.fields.Function>` and :class:`Method <marshmallow.fields.Method>` fields will have access to this dictionary.
|
|
105
105
|
|
|
106
106
|
As an example, you might want your ``UserSchema`` to output whether or not a ``User`` is the author of a ``Blog`` or whether a certain word appears in a ``Blog's`` title.
|
|
107
107
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
.. module:: marshmallow
|
|
2
|
-
|
|
3
1
|
********
|
|
4
2
|
Examples
|
|
5
3
|
********
|
|
@@ -12,7 +10,7 @@ Below is a schema that could be used to validate
|
|
|
12
10
|
``package.json`` files. This example demonstrates the following features:
|
|
13
11
|
|
|
14
12
|
|
|
15
|
-
- Validation and deserialization using
|
|
13
|
+
- Validation and deserialization using `Schema.load <marshmallow.Schema.load>`
|
|
16
14
|
- :doc:`Custom fields <custom_fields>`
|
|
17
15
|
- Specifying deserialization keys using ``data_key``
|
|
18
16
|
- Including unknown keys using ``unknown = INCLUDE``
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
.. module:: marshmallow
|
|
2
|
-
|
|
3
1
|
Extending schemas
|
|
4
2
|
=================
|
|
5
3
|
|
|
@@ -213,6 +211,8 @@ The pipeline for serialization is similar, except that the ``pass_many=True`` pr
|
|
|
213
211
|
def step2(self, data, **kwargs):
|
|
214
212
|
do_step2(data)
|
|
215
213
|
|
|
214
|
+
.. _schema_validation:
|
|
215
|
+
|
|
216
216
|
Schema-level validation
|
|
217
217
|
-----------------------
|
|
218
218
|
|
|
@@ -347,7 +347,7 @@ However, if you want to specify how values are accessed from an object, you can
|
|
|
347
347
|
Custom error handling
|
|
348
348
|
---------------------
|
|
349
349
|
|
|
350
|
-
By default,
|
|
350
|
+
By default, `Schema.load <marshmallow.Schema.load>` will raise a :exc:`ValidationError <marshmallow.exceptions.ValidationError>` if passed invalid data.
|
|
351
351
|
|
|
352
352
|
You can specify a custom error-handling function for a :class:`Schema` by overriding the `handle_error <marshmallow.Schema.handle_error>` method. The method receives the :exc:`ValidationError <marshmallow.exceptions.ValidationError>` and the original input data to be deserialized.
|
|
353
353
|
|
|
@@ -457,7 +457,7 @@ Our application schemas can now inherit from our custom schema class.
|
|
|
457
457
|
Using context
|
|
458
458
|
-------------
|
|
459
459
|
|
|
460
|
-
The ``context`` attribute of a `Schema
|
|
460
|
+
The ``context`` attribute of a `Schema <marshmallow.Schema>` is a general-purpose store for extra information that may be needed for (de)serialization. It may be used in both ``Schema`` and ``Field`` methods.
|
|
461
461
|
|
|
462
462
|
.. code-block:: python
|
|
463
463
|
|
|
@@ -261,7 +261,7 @@ This is useful for avoiding circular imports when your schemas are located in di
|
|
|
261
261
|
Nesting a schema within itself
|
|
262
262
|
------------------------------
|
|
263
263
|
|
|
264
|
-
If the object to be marshalled has a relationship to an object of the same type, you can nest the `Schema
|
|
264
|
+
If the object to be marshalled has a relationship to an object of the same type, you can nest the `Schema <marshmallow.Schema>` within itself by passing a callable that returns an instance of the same schema.
|
|
265
265
|
|
|
266
266
|
.. code-block:: python
|
|
267
267
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
.. module:: marshmallow
|
|
2
|
-
|
|
3
1
|
Quickstart
|
|
4
2
|
==========
|
|
5
3
|
|
|
@@ -176,7 +174,7 @@ Set ``many=True`` when dealing with iterable collections of objects.
|
|
|
176
174
|
Validation
|
|
177
175
|
----------
|
|
178
176
|
|
|
179
|
-
|
|
177
|
+
`Schema.load <marshmallow.Schema.load>` (and its JSON-decoding counterpart, `Schema.loads <marshmallow.Schema.loads>`) raises a :exc:`ValidationError <marshmallow.exceptions.ValidationError>` error when invalid data are passed in. You can access the dictionary of validation errors from the `ValidationError.messages <marshmallow.exceptions.ValidationError.messages>` attribute. The data that were correctly deserialized are accessible in `ValidationError.valid_data <marshmallow.exceptions.ValidationError.valid_data>`. Some fields, such as the :class:`Email <fields.Email>` and :class:`URL <fields.URL>` fields, have built-in validation.
|
|
180
178
|
|
|
181
179
|
.. code-block:: python
|
|
182
180
|
|
|
@@ -275,7 +273,7 @@ You may also pass a collection (list, tuple, generator) of callables to ``valida
|
|
|
275
273
|
.. warning::
|
|
276
274
|
|
|
277
275
|
Validation occurs on deserialization but not on serialization.
|
|
278
|
-
To improve serialization performance, data passed to
|
|
276
|
+
To improve serialization performance, data passed to `Schema.dump <marshmallow.Schema.dump>`
|
|
279
277
|
are considered valid.
|
|
280
278
|
|
|
281
279
|
.. seealso::
|
|
@@ -286,7 +284,7 @@ You may also pass a collection (list, tuple, generator) of callables to ``valida
|
|
|
286
284
|
|
|
287
285
|
.. seealso::
|
|
288
286
|
|
|
289
|
-
Need schema-level validation? See the :ref:`Extending Schemas <
|
|
287
|
+
Need schema-level validation? See the :ref:`Extending Schemas <schema_validation>` page.
|
|
290
288
|
|
|
291
289
|
|
|
292
290
|
Field validators as methods
|
|
@@ -313,7 +311,7 @@ It is sometimes convenient to write validators as methods. Use the `validates <m
|
|
|
313
311
|
Required fields
|
|
314
312
|
---------------
|
|
315
313
|
|
|
316
|
-
Make a field required by passing ``required=True``. An error will be raised if the the value is missing from the input to
|
|
314
|
+
Make a field required by passing ``required=True``. An error will be raised if the the value is missing from the input to `Schema.load <marshmallow.Schema.load>`.
|
|
317
315
|
|
|
318
316
|
To customize the error message for required fields, pass a `dict` with a ``required`` key as the ``error_messages`` argument for the field.
|
|
319
317
|
|
|
@@ -405,7 +403,7 @@ This behavior can be modified with the ``unknown`` option, which accepts one of
|
|
|
405
403
|
- `EXCLUDE <marshmallow.utils.EXCLUDE>`: exclude unknown fields
|
|
406
404
|
- `INCLUDE <marshmallow.utils.INCLUDE>`: accept and include the unknown fields
|
|
407
405
|
|
|
408
|
-
You can specify ``unknown`` in the *class Meta* of your `Schema
|
|
406
|
+
You can specify ``unknown`` in the *class Meta* of your `Schema <marshmallow.Schema>`,
|
|
409
407
|
|
|
410
408
|
.. code-block:: python
|
|
411
409
|
|
|
@@ -436,7 +434,7 @@ This order of precedence allows you to change the behavior of a schema for diffe
|
|
|
436
434
|
Validation without deserialization
|
|
437
435
|
----------------------------------
|
|
438
436
|
|
|
439
|
-
If you only need to validate input data (without deserializing to an object), you can use
|
|
437
|
+
If you only need to validate input data (without deserializing to an object), you can use `Schema.validate <marshmallow.Schema.validate>`.
|
|
440
438
|
|
|
441
439
|
.. code-block:: python
|
|
442
440
|
|
|
@@ -6,7 +6,7 @@ This section documents migration paths to new releases.
|
|
|
6
6
|
Upgrading to 3.3
|
|
7
7
|
++++++++++++++++
|
|
8
8
|
|
|
9
|
-
In 3.3, `fields.Nested <marshmallow.fields.Nested>` may take a callable that returns a schema instance.
|
|
9
|
+
In 3.3, `fields.Nested <marshmallow.fields.Nested>` may take a callable that returns a schema instance.
|
|
10
10
|
Use this to resolve order-of-declaration issues when schemas nest each other.
|
|
11
11
|
|
|
12
12
|
.. code-block:: python
|
|
@@ -103,15 +103,15 @@ along with the valid data from the `ValidationError.valid_data
|
|
|
103
103
|
errors = err.messages
|
|
104
104
|
valid_data = err.valid_data
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
`Schema.validate <marshmallow.Schema.validate>` always returns a dictionary of validation errors (same as 2.x with ``strict=False``).
|
|
107
107
|
|
|
108
108
|
.. code-block:: python
|
|
109
109
|
|
|
110
110
|
schema.validate({"email": "invalid"})
|
|
111
111
|
# {'email': ['Not a valid email address.']}
|
|
112
112
|
|
|
113
|
-
Setting the ``strict`` option on ``class Meta`` has no effect on `Schema
|
|
114
|
-
Passing ``strict=True`` or ``strict=False`` to the `Schema
|
|
113
|
+
Setting the ``strict`` option on ``class Meta`` has no effect on `Schema <marshmallow.Schema>` behavior.
|
|
114
|
+
Passing ``strict=True`` or ``strict=False`` to the `Schema <marshmallow.Schema>` constructor
|
|
115
115
|
will raise a :exc:`TypeError`.
|
|
116
116
|
|
|
117
117
|
|
|
@@ -182,7 +182,7 @@ and `validates_schema <marshmallow.decorators.validates_schema>` receive
|
|
|
182
182
|
Validation does not occur on serialization
|
|
183
183
|
******************************************
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
`Schema.dump <marshmallow.Schema.dump>` will no longer validate and collect error messages. You *must* validate
|
|
186
186
|
your data before serializing it.
|
|
187
187
|
|
|
188
188
|
.. code-block:: python
|
|
@@ -737,7 +737,7 @@ The same key is used for serialization and deserialization.
|
|
|
737
737
|
email = fields.Email(data_key="CamelCasedEmail")
|
|
738
738
|
|
|
739
739
|
It is not possible to specify a different key for serialization and deserialization on the same field.
|
|
740
|
-
This use case is covered by using two different `Schema
|
|
740
|
+
This use case is covered by using two different `Schema <marshmallow.Schema>`.
|
|
741
741
|
|
|
742
742
|
.. code-block:: python
|
|
743
743
|
|
|
@@ -970,8 +970,8 @@ The ``prefix`` parameter of ``Schema`` is removed. The same feature can be achie
|
|
|
970
970
|
|
|
971
971
|
# 2.x
|
|
972
972
|
class MySchema(Schema):
|
|
973
|
-
f1 = fields.
|
|
974
|
-
f2 = fields.
|
|
973
|
+
f1 = fields.Raw()
|
|
974
|
+
f2 = fields.Raw()
|
|
975
975
|
|
|
976
976
|
|
|
977
977
|
MySchema(prefix="pre_").dump({"f1": "one", "f2": "two"})
|
|
@@ -980,8 +980,8 @@ The ``prefix`` parameter of ``Schema`` is removed. The same feature can be achie
|
|
|
980
980
|
|
|
981
981
|
# 3.x
|
|
982
982
|
class MySchema(Schema):
|
|
983
|
-
f1 = fields.
|
|
984
|
-
f2 = fields.
|
|
983
|
+
f1 = fields.Raw()
|
|
984
|
+
f2 = fields.Raw()
|
|
985
985
|
|
|
986
986
|
@post_dump
|
|
987
987
|
def prefix_usr(self, data):
|
|
@@ -1025,10 +1025,10 @@ In marshmallow 2, it was possible to have multiple fields with the same ``attrib
|
|
|
1025
1025
|
|
|
1026
1026
|
# 2.x
|
|
1027
1027
|
class MySchema(Schema):
|
|
1028
|
-
f1 = fields.
|
|
1029
|
-
f2 = fields.
|
|
1030
|
-
f3 = fields.
|
|
1031
|
-
f4 = fields.
|
|
1028
|
+
f1 = fields.Raw()
|
|
1029
|
+
f2 = fields.Raw(attribute="f1")
|
|
1030
|
+
f3 = fields.Raw(attribute="f5")
|
|
1031
|
+
f4 = fields.Raw(attribute="f5")
|
|
1032
1032
|
|
|
1033
1033
|
|
|
1034
1034
|
MySchema()
|
|
@@ -1037,10 +1037,10 @@ In marshmallow 2, it was possible to have multiple fields with the same ``attrib
|
|
|
1037
1037
|
|
|
1038
1038
|
# 3.x
|
|
1039
1039
|
class MySchema(Schema):
|
|
1040
|
-
f1 = fields.
|
|
1041
|
-
f2 = fields.
|
|
1042
|
-
f3 = fields.
|
|
1043
|
-
f4 = fields.
|
|
1040
|
+
f1 = fields.Raw()
|
|
1041
|
+
f2 = fields.Raw(attribute="f1")
|
|
1042
|
+
f3 = fields.Raw(attribute="f5")
|
|
1043
|
+
f4 = fields.Raw(attribute="f5")
|
|
1044
1044
|
|
|
1045
1045
|
|
|
1046
1046
|
MySchema()
|
|
@@ -1048,10 +1048,10 @@ In marshmallow 2, it was possible to have multiple fields with the same ``attrib
|
|
|
1048
1048
|
|
|
1049
1049
|
|
|
1050
1050
|
class MySchema(Schema):
|
|
1051
|
-
f1 = fields.
|
|
1052
|
-
f2 = fields.
|
|
1053
|
-
f3 = fields.
|
|
1054
|
-
f4 = fields.
|
|
1051
|
+
f1 = fields.Raw()
|
|
1052
|
+
f2 = fields.Raw(attribute="f1", dump_only=True)
|
|
1053
|
+
f3 = fields.Raw(attribute="f5")
|
|
1054
|
+
f4 = fields.Raw(attribute="f5", dump_only=True)
|
|
1055
1055
|
|
|
1056
1056
|
|
|
1057
1057
|
MySchema()
|
|
@@ -1061,7 +1061,7 @@ In marshmallow 2, it was possible to have multiple fields with the same ``attrib
|
|
|
1061
1061
|
``Field.fail`` is deprecated in favor of ``Field.make_error``
|
|
1062
1062
|
*************************************************************
|
|
1063
1063
|
|
|
1064
|
-
`Field.fail <marshmallow.fields.Field.fail>` is deprecated.
|
|
1064
|
+
`Field.fail <marshmallow.fields.Field.fail>` is deprecated.
|
|
1065
1065
|
Use `Field.make_error <marshmallow.fields.Field.fail>`. This allows you to
|
|
1066
1066
|
re-raise exceptions using ``raise ... from ...``.
|
|
1067
1067
|
|
|
@@ -1242,7 +1242,7 @@ As a consequence of this new behavior, the ``skip_missing`` class Meta option ha
|
|
|
1242
1242
|
Pre-processing and post-processing methods
|
|
1243
1243
|
******************************************
|
|
1244
1244
|
|
|
1245
|
-
The pre- and post-processing API was significantly improved for better consistency and flexibility. The `pre_load <marshmallow.decorators.pre_load>`, `post_load <marshmallow.decorators.post_load>`, `pre_dump <marshmallow.decorators.pre_dump>`, and `post_dump <marshmallow.decorators.post_dump>` should be used to define processing hooks.
|
|
1245
|
+
The pre- and post-processing API was significantly improved for better consistency and flexibility. The `pre_load <marshmallow.decorators.pre_load>`, `post_load <marshmallow.decorators.post_load>`, `pre_dump <marshmallow.decorators.pre_dump>`, and `post_dump <marshmallow.decorators.post_dump>` should be used to define processing hooks. ``Schema.preprocessor`` and ``Schema.data_handler`` are removed.
|
|
1246
1246
|
|
|
1247
1247
|
|
|
1248
1248
|
.. code-block:: python
|
|
@@ -1289,7 +1289,7 @@ See the :doc:`Extending Schemas <extending>` page for more information on the ``
|
|
|
1289
1289
|
Schema validators
|
|
1290
1290
|
*****************
|
|
1291
1291
|
|
|
1292
|
-
Similar to pre-processing and post-processing methods, schema validators are now defined as methods. Decorate schema validators with `validates_schema <marshmallow.decorators.validates_schema>`.
|
|
1292
|
+
Similar to pre-processing and post-processing methods, schema validators are now defined as methods. Decorate schema validators with `validates_schema <marshmallow.decorators.validates_schema>`. ``Schema.validator`` is removed.
|
|
1293
1293
|
|
|
1294
1294
|
.. code-block:: python
|
|
1295
1295
|
|
|
@@ -1324,7 +1324,7 @@ Similar to pre-processing and post-processing methods, schema validators are now
|
|
|
1324
1324
|
Custom accessors and error handlers
|
|
1325
1325
|
***********************************
|
|
1326
1326
|
|
|
1327
|
-
Custom accessors and error handlers are now defined as methods.
|
|
1327
|
+
Custom accessors and error handlers are now defined as methods. ``Schema.accessor`` and ``Schema.error_handler`` are deprecated.
|
|
1328
1328
|
|
|
1329
1329
|
.. code-block:: python
|
|
1330
1330
|
|
|
@@ -1432,7 +1432,7 @@ The :exc:`MarshallingError` and :exc:`UnmarshallingError` exceptions are depreca
|
|
|
1432
1432
|
Handle ``ValidationError`` in strict mode
|
|
1433
1433
|
-----------------------------------------
|
|
1434
1434
|
|
|
1435
|
-
When using `strict` mode, you should handle `ValidationErrors` when calling `Schema.dump
|
|
1435
|
+
When using `strict` mode, you should handle `ValidationErrors` when calling `Schema.dump <marshmallow.Schema.dump>` and `Schema.load <marshmallow.Schema.load>`.
|
|
1436
1436
|
|
|
1437
1437
|
.. code-block:: python
|
|
1438
1438
|
|
|
@@ -1707,7 +1707,7 @@ Perhaps the largest change is in how objects get serialized. Serialization occur
|
|
|
1707
1707
|
|
|
1708
1708
|
.. note::
|
|
1709
1709
|
|
|
1710
|
-
Some crucial parts of the pre-1.0 API have been retained to ease the transition. You can still pass an object to a `Schema
|
|
1710
|
+
Some crucial parts of the pre-1.0 API have been retained to ease the transition. You can still pass an object to a `Schema <marshmallow.Schema>` constructor and access the `Schema.data` and `Schema.errors` properties. The `is_valid` method, however, has been completely removed. It is recommended that you migrate to the new API to prevent future releases from breaking your code.
|
|
1711
1711
|
|
|
1712
1712
|
The Fields interface was also reworked in 1.0 to make it easier to define custom fields with their own serialization and deserialization behavior. Custom fields now implement :meth:`Field._serialize` and :meth:`Field._deserialize`.
|
|
1713
1713
|
|
|
@@ -1753,11 +1753,11 @@ Another major change in 1.0 is that multiple validation errors can be stored for
|
|
|
1753
1753
|
|
|
1754
1754
|
Other notable changes:
|
|
1755
1755
|
|
|
1756
|
-
- Serialized output is no longer an
|
|
1757
|
-
-
|
|
1756
|
+
- Serialized output is no longer an ``OrderedDict`` by default. You must explicitly set the `ordered` class Meta option to `True` .
|
|
1757
|
+
- ``Serializer`` has been renamed to `Schema <marshmallow.schema.Schema>`, but you can still import ``marshmallow.Serializer`` (which is aliased to `Schema <marshmallow.Schema>`).
|
|
1758
1758
|
- ``datetime`` objects serialize to ISO8601-formatted strings by default (instead of RFC821 format).
|
|
1759
1759
|
- The ``fields.validated`` decorator was removed, as it is no longer necessary given the new Fields interface.
|
|
1760
|
-
-
|
|
1760
|
+
- ``Schema.factory`` class method was removed.
|
|
1761
1761
|
|
|
1762
1762
|
.. seealso::
|
|
1763
1763
|
|
|
@@ -70,12 +70,12 @@ def register(classname: str, cls: SchemaType) -> None:
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
@typing.overload
|
|
73
|
-
def get_class(classname: str, all: typing.Literal[False]) -> SchemaType: ...
|
|
73
|
+
def get_class(classname: str, all: typing.Literal[False] = ...) -> SchemaType: ...
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
@typing.overload
|
|
77
77
|
def get_class(
|
|
78
|
-
classname: str, all: typing.Literal[True]
|
|
78
|
+
classname: str, all: typing.Literal[True] = ...
|
|
79
79
|
) -> list[SchemaType] | SchemaType: ...
|
|
80
80
|
|
|
81
81
|
|
|
@@ -100,7 +100,7 @@ def validates_schema(
|
|
|
100
100
|
"""Register a schema-level validator.
|
|
101
101
|
|
|
102
102
|
By default it receives a single object at a time, transparently handling the ``many``
|
|
103
|
-
argument passed to the `Schema
|
|
103
|
+
argument passed to the `Schema <marshmallow.Schema>`'s :func:`~marshmallow.Schema.validate` call.
|
|
104
104
|
If ``pass_many=True``, the raw data (which may be a collection) is passed.
|
|
105
105
|
|
|
106
106
|
If ``pass_original=True``, the original data (before unmarshalling) will be passed as
|
|
@@ -132,7 +132,7 @@ def pre_dump(
|
|
|
132
132
|
receives the object to be serialized and returns the processed object.
|
|
133
133
|
|
|
134
134
|
By default it receives a single object at a time, transparently handling the ``many``
|
|
135
|
-
argument passed to the `Schema
|
|
135
|
+
argument passed to the `Schema <marshmallow.Schema>`'s :func:`~marshmallow.Schema.dump` call.
|
|
136
136
|
If ``pass_many=True``, the raw data (which may be a collection) is passed.
|
|
137
137
|
|
|
138
138
|
.. versionchanged:: 3.0.0
|
|
@@ -150,7 +150,7 @@ def post_dump(
|
|
|
150
150
|
receives the serialized object and returns the processed object.
|
|
151
151
|
|
|
152
152
|
By default it receives a single object at a time, transparently handling the ``many``
|
|
153
|
-
argument passed to the `Schema
|
|
153
|
+
argument passed to the `Schema <marshmallow.Schema>`'s :func:`~marshmallow.Schema.dump` call.
|
|
154
154
|
If ``pass_many=True``, the raw data (which may be a collection) is passed.
|
|
155
155
|
|
|
156
156
|
If ``pass_original=True``, the original data (before serializing) will be passed as
|
|
@@ -169,7 +169,7 @@ def pre_load(
|
|
|
169
169
|
receives the data to be deserialized and returns the processed data.
|
|
170
170
|
|
|
171
171
|
By default it receives a single object at a time, transparently handling the ``many``
|
|
172
|
-
argument passed to the `Schema
|
|
172
|
+
argument passed to the `Schema <marshmallow.Schema>`'s :func:`~marshmallow.Schema.load` call.
|
|
173
173
|
If ``pass_many=True``, the raw data (which may be a collection) is passed.
|
|
174
174
|
|
|
175
175
|
.. versionchanged:: 3.0.0
|
|
@@ -188,7 +188,7 @@ def post_load(
|
|
|
188
188
|
receives the deserialized data and returns the processed data.
|
|
189
189
|
|
|
190
190
|
By default it receives a single object at a time, transparently handling the ``many``
|
|
191
|
-
argument passed to the `Schema
|
|
191
|
+
argument passed to the `Schema <marshmallow.Schema>`'s :func:`~marshmallow.Schema.load` call.
|
|
192
192
|
If ``pass_many=True``, the raw data (which may be a collection) is passed.
|
|
193
193
|
|
|
194
194
|
If ``pass_original=True``, the original data (before deserializing) will be passed as
|
|
@@ -139,16 +139,6 @@ class Field(FieldABC):
|
|
|
139
139
|
"validator_failed": "Invalid value.",
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
def __new__(cls, *args, **kwargs):
|
|
143
|
-
if cls is Field:
|
|
144
|
-
warnings.warn(
|
|
145
|
-
"`Field` should not be instantiated. Use `fields.Raw` or "
|
|
146
|
-
"another field subclass instead.",
|
|
147
|
-
ChangedInMarshmallow4Warning,
|
|
148
|
-
stacklevel=2,
|
|
149
|
-
)
|
|
150
|
-
return super().__new__(cls)
|
|
151
|
-
|
|
152
142
|
def __init__(
|
|
153
143
|
self,
|
|
154
144
|
*,
|
|
@@ -171,6 +161,13 @@ class Field(FieldABC):
|
|
|
171
161
|
metadata: typing.Mapping[str, typing.Any] | None = None,
|
|
172
162
|
**additional_metadata,
|
|
173
163
|
) -> None:
|
|
164
|
+
if self.__class__ is Field:
|
|
165
|
+
warnings.warn(
|
|
166
|
+
"`Field` should not be instantiated. Use `fields.Raw` or "
|
|
167
|
+
"another field subclass instead.",
|
|
168
|
+
ChangedInMarshmallow4Warning,
|
|
169
|
+
stacklevel=2,
|
|
170
|
+
)
|
|
174
171
|
# handle deprecated `default` and `missing` parameters
|
|
175
172
|
if default is not missing_:
|
|
176
173
|
warnings.warn(
|
|
@@ -361,7 +358,7 @@ class Field(FieldABC):
|
|
|
361
358
|
|
|
362
359
|
:param value: The value to deserialize.
|
|
363
360
|
:param attr: The attribute/key in `data` to deserialize.
|
|
364
|
-
:param data: The raw input data passed to `Schema.load
|
|
361
|
+
:param data: The raw input data passed to `Schema.load <marshmallow.Schema.load>`.
|
|
365
362
|
:param kwargs: Field-specific keyword arguments.
|
|
366
363
|
:raise ValidationError: If an invalid value is passed or if a required value
|
|
367
364
|
is missing.
|
|
@@ -382,7 +379,7 @@ class Field(FieldABC):
|
|
|
382
379
|
|
|
383
380
|
def _bind_to_schema(self, field_name: str, schema: Schema | Field) -> None:
|
|
384
381
|
"""Update field with values from its parent schema. Called by
|
|
385
|
-
|
|
382
|
+
`Schema._bind_field <marshmallow.Schema._bind_field>`.
|
|
386
383
|
|
|
387
384
|
:param str field_name: Field name set in schema.
|
|
388
385
|
:param Schema|Field schema: Parent object.
|
|
@@ -426,7 +423,7 @@ class Field(FieldABC):
|
|
|
426
423
|
|
|
427
424
|
:param value: The value to be deserialized.
|
|
428
425
|
:param attr: The attribute/key in `data` to be deserialized.
|
|
429
|
-
:param data: The raw input data passed to the `Schema.load
|
|
426
|
+
:param data: The raw input data passed to the `Schema.load <marshmallow.Schema.load>`.
|
|
430
427
|
:param kwargs: Field-specific keyword arguments.
|
|
431
428
|
:raise ValidationError: In case of formatting or validation failure.
|
|
432
429
|
:return: The deserialized value.
|
|
@@ -440,7 +437,7 @@ class Field(FieldABC):
|
|
|
440
437
|
|
|
441
438
|
@property
|
|
442
439
|
def context(self) -> dict | None:
|
|
443
|
-
"""The context dictionary for the parent
|
|
440
|
+
"""The context dictionary for the parent `Schema <marshmallow.Schema>`."""
|
|
444
441
|
if self.parent:
|
|
445
442
|
return self.parent.context
|
|
446
443
|
return None
|
|
@@ -527,8 +524,9 @@ class Nested(Field):
|
|
|
527
524
|
# No
|
|
528
525
|
author = fields.Nested(UserSchema(), only=("id", "name"))
|
|
529
526
|
|
|
530
|
-
:param nested: `Schema
|
|
531
|
-
returns a `Schema
|
|
527
|
+
:param nested: `Schema <marshmallow.Schema>` instance, class, class name (string), dictionary, or callable that
|
|
528
|
+
returns a `Schema <marshmallow.Schema>` or dictionary.
|
|
529
|
+
Dictionaries are converted with `Schema.from_dict <marshmallow.Schema.from_dict>`.
|
|
532
530
|
:param exclude: A list or tuple of fields to exclude.
|
|
533
531
|
:param only: A list or tuple of fields to marshal. If `None`, all fields are marshalled.
|
|
534
532
|
This parameter takes precedence over ``exclude``.
|
|
@@ -583,10 +581,10 @@ class Nested(Field):
|
|
|
583
581
|
|
|
584
582
|
@property
|
|
585
583
|
def schema(self) -> Schema:
|
|
586
|
-
"""The nested Schema object.
|
|
584
|
+
"""The nested `Schema <marshmallow.Schema>` object.
|
|
587
585
|
|
|
588
586
|
.. versionchanged:: 1.0.0
|
|
589
|
-
Renamed from
|
|
587
|
+
Renamed from ``serializer`` to ``schema``.
|
|
590
588
|
"""
|
|
591
589
|
if not self._schema:
|
|
592
590
|
# Inherit context from parent.
|
|
@@ -681,8 +679,8 @@ class Nested(Field):
|
|
|
681
679
|
) -> typing.Any:
|
|
682
680
|
"""Same as :meth:`Field._deserialize` with additional ``partial`` argument.
|
|
683
681
|
|
|
684
|
-
:param
|
|
685
|
-
parameter passed to `Schema.load`.
|
|
682
|
+
:param partial: For nested schemas, the ``partial``
|
|
683
|
+
parameter passed to `marshmallow.Schema.load`.
|
|
686
684
|
|
|
687
685
|
.. versionchanged:: 3.0.0
|
|
688
686
|
Add ``partial`` parameter.
|
|
@@ -713,7 +711,7 @@ class Pluck(Nested):
|
|
|
713
711
|
dumped = AlbumSchema().dump(loaded) # => {'artist': 42}
|
|
714
712
|
|
|
715
713
|
:param Schema nested: The Schema class or class name (string)
|
|
716
|
-
to nest, or ``"self"`` to nest the
|
|
714
|
+
to nest, or ``"self"`` to nest the `Schema <marshmallow.Schema>` within itself.
|
|
717
715
|
:param str field_name: The key to pluck a value from.
|
|
718
716
|
:param kwargs: The same keyword arguments that :class:`Nested` receives.
|
|
719
717
|
"""
|
|
@@ -962,16 +960,13 @@ class Number(Field, typing.Generic[_NumType]):
|
|
|
962
960
|
"too_large": "Number too large.",
|
|
963
961
|
}
|
|
964
962
|
|
|
965
|
-
def
|
|
966
|
-
if
|
|
963
|
+
def __init__(self, *, as_string: bool = False, **kwargs):
|
|
964
|
+
if self.__class__ is Number:
|
|
967
965
|
warnings.warn(
|
|
968
966
|
"`Number` field should not be instantiated. Use `Integer`, `Float`, or `Decimal` instead.",
|
|
969
967
|
ChangedInMarshmallow4Warning,
|
|
970
968
|
stacklevel=2,
|
|
971
969
|
)
|
|
972
|
-
return super().__new__(cls)
|
|
973
|
-
|
|
974
|
-
def __init__(self, *, as_string: bool = False, **kwargs):
|
|
975
970
|
self.as_string = as_string
|
|
976
971
|
super().__init__(**kwargs)
|
|
977
972
|
|
|
@@ -1578,21 +1573,18 @@ class Mapping(Field):
|
|
|
1578
1573
|
#: Default error messages.
|
|
1579
1574
|
default_error_messages = {"invalid": "Not a valid mapping type."}
|
|
1580
1575
|
|
|
1581
|
-
def __new__(cls, *args, **kwargs):
|
|
1582
|
-
if cls is Mapping:
|
|
1583
|
-
warnings.warn(
|
|
1584
|
-
"`Mapping` field should not be instantiated. Use `Dict` instead.",
|
|
1585
|
-
ChangedInMarshmallow4Warning,
|
|
1586
|
-
stacklevel=2,
|
|
1587
|
-
)
|
|
1588
|
-
return super().__new__(cls)
|
|
1589
|
-
|
|
1590
1576
|
def __init__(
|
|
1591
1577
|
self,
|
|
1592
1578
|
keys: Field | type[Field] | None = None,
|
|
1593
1579
|
values: Field | type[Field] | None = None,
|
|
1594
1580
|
**kwargs,
|
|
1595
1581
|
):
|
|
1582
|
+
if self.__class__ is Mapping:
|
|
1583
|
+
warnings.warn(
|
|
1584
|
+
"`Mapping` field should not be instantiated. Use `Dict` instead.",
|
|
1585
|
+
ChangedInMarshmallow4Warning,
|
|
1586
|
+
stacklevel=2,
|
|
1587
|
+
)
|
|
1596
1588
|
super().__init__(**kwargs)
|
|
1597
1589
|
if keys is None:
|
|
1598
1590
|
self.key_field = None
|
|
@@ -1965,7 +1957,7 @@ class Enum(Field):
|
|
|
1965
1957
|
|
|
1966
1958
|
|
|
1967
1959
|
class Method(Field):
|
|
1968
|
-
"""A field that takes the value returned by a `Schema
|
|
1960
|
+
"""A field that takes the value returned by a `Schema <marshmallow.Schema>` method.
|
|
1969
1961
|
|
|
1970
1962
|
:param str serialize: The name of the Schema method from which
|
|
1971
1963
|
to retrieve the value. The method must take an argument ``obj``
|
|
@@ -344,15 +344,15 @@ class Schema(metaclass=SchemaMeta):
|
|
|
344
344
|
- ``timeformat``: Default format for `Time <fields.Time>` fields.
|
|
345
345
|
- ``render_module``: Module to use for `loads <Schema.loads>` and `dumps <Schema.dumps>`.
|
|
346
346
|
Defaults to `json` from the standard library.
|
|
347
|
-
- ``ordered``: If `True`, output of `Schema.dump
|
|
347
|
+
- ``ordered``: If `True`, output of `Schema.dump <marshmallow.Schema.dump>` will be a `collections.OrderedDict`.
|
|
348
348
|
- ``index_errors``: If `True`, errors dictionaries will include the index
|
|
349
349
|
of invalid items in a collection.
|
|
350
350
|
- ``load_only``: Tuple or list of fields to exclude from serialized results.
|
|
351
351
|
- ``dump_only``: Tuple or list of fields to exclude from deserialization
|
|
352
352
|
- ``unknown``: Whether to exclude, include, or raise an error for unknown
|
|
353
353
|
fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
|
|
354
|
-
- ``register``: Whether to register the `Schema
|
|
355
|
-
class registry. Must be `True` if you intend to refer to this `Schema
|
|
354
|
+
- ``register``: Whether to register the `Schema <marshmallow.Schema>` with marshmallow's internal
|
|
355
|
+
class registry. Must be `True` if you intend to refer to this `Schema <marshmallow.Schema>`
|
|
356
356
|
by class name in `Nested` fields. Only set this to `False` when memory
|
|
357
357
|
usage is critical. Defaults to `True`.
|
|
358
358
|
"""
|
|
@@ -428,7 +428,7 @@ class Schema(metaclass=SchemaMeta):
|
|
|
428
428
|
*,
|
|
429
429
|
name: str = "GeneratedSchema",
|
|
430
430
|
) -> type[Schema]:
|
|
431
|
-
"""Generate a `Schema
|
|
431
|
+
"""Generate a `Schema <marshmallow.Schema>` class given a dictionary of fields.
|
|
432
432
|
|
|
433
433
|
.. code-block:: python
|
|
434
434
|
|
|
@@ -1016,7 +1016,7 @@ class Schema(metaclass=SchemaMeta):
|
|
|
1016
1016
|
self.load_fields = load_fields
|
|
1017
1017
|
|
|
1018
1018
|
def on_bind_field(self, field_name: str, field_obj: ma_fields.Field) -> None:
|
|
1019
|
-
"""Hook to modify a field when it is bound to the `Schema
|
|
1019
|
+
"""Hook to modify a field when it is bound to the `Schema <marshmallow.Schema>`.
|
|
1020
1020
|
|
|
1021
1021
|
No-op by default.
|
|
1022
1022
|
"""
|
|
@@ -39,7 +39,7 @@ class _Missing:
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
# Singleton value that indicates that a field's value is missing from input
|
|
42
|
-
# dict passed to
|
|
42
|
+
# dict passed to `Schema.load <marshmallow.Schema.load>`. If the field's value is not required,
|
|
43
43
|
# it's ``default`` value is used.
|
|
44
44
|
missing = _Missing()
|
|
45
45
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|