Skip to content

Commit 05cdf8c

Browse files
authored
Document base field deprecations in API docs (#2750)
* Document base field deprecations in API docs * Update changelog
1 parent 1e03e2c commit 05cdf8c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Changelog
66

77
Documentation:
88

9-
- Various documentation improvements (:pr:`2746`).
9+
- Various documentation improvements (:pr:`2746`, :pr:`2747`, :pr:`2748`, :pr:`2749`, :pr:`2750`).
1010

1111
3.25.0 (2025-01-09)
1212
*******************

src/marshmallow/fields.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@
8080

8181

8282
class Field(FieldABC):
83-
"""Basic field from which other fields should extend. It applies no
84-
formatting by default, and should only be used in cases where
85-
data does not need to be formatted before being serialized or deserialized.
83+
"""Base field from which other fields inherit.
8684
8785
:param dump_default: If set, this value will be used during serialization if the
8886
input value is missing. If not set, the field will be excluded from the
@@ -123,6 +121,10 @@ class Field(FieldABC):
123121
124122
.. versionchanged:: 3.13.0
125123
Replace ``missing`` and ``default`` parameters with ``load_default`` and ``dump_default``.
124+
125+
.. versionchanged:: 3.24.0
126+
`Field <marshmallow.fields.Field>` should no longer be used as a field within a `Schema <marshmallow.Schema>`.
127+
Use `Raw <marshmallow.fields.Raw>` or another `Field <marshmallow.fields.Field>` subclass instead.
126128
"""
127129

128130
# Some fields, such as Method fields and Function fields, are not expected
@@ -950,6 +952,10 @@ class Number(Field, typing.Generic[_NumType]):
950952
951953
:param as_string: If `True`, format the serialized value as a string.
952954
:param kwargs: The same keyword arguments that :class:`Field` receives.
955+
956+
.. versionchanged:: 3.24.0
957+
`Number <marshmallow.fields.Number>` should no longer be used as a field within a `Schema <marshmallow.Schema>`.
958+
Use `Integer <marshmallow.fields.Integer>`, `Float <marshmallow.fields.Float>`, or `Decimal <marshmallow.fields.Decimal>` instead.
953959
"""
954960

955961
num_type: type = float
@@ -1566,6 +1572,9 @@ class Mapping(Field):
15661572
`keys` and `values` arguments to prevent content validation.
15671573
15681574
.. versionadded:: 3.0.0rc4
1575+
.. versionchanged:: 3.24.0
1576+
`Mapping <marshmallow.fields.Mapping>` should no longer be used as a field within a `Schema <marshmallow.Schema>`.
1577+
Use `Dict <marshmallow.fields.Dict>` instead.
15691578
"""
15701579

15711580
mapping_type = dict

0 commit comments

Comments
 (0)