flask_accepts icon indicating copy to clipboard operation
flask_accepts copied to clipboard

Marshmallow 4 breaking changes

Open kreathon opened this issue 3 years ago • 0 comments

The use of missing/default field parameters is deprecated and will be removed in marshmallow 4. load_default/dump_default should be used instead.

Source: https://github.com/marshmallow-code/marshmallow/blob/dev/CHANGELOG.rst#3130-2021-07-21

The following code as well as the tests are affected:

def _ma_field_to_fr_field(value: ma.Field) -> dict:
    fr_field_parameters = {}

    if hasattr(value, "default") and type(value.default) != ma.utils._Missing:
        fr_field_parameters["example"] = value.default
    ...
    if hasattr(value, "missing") and type(value.missing) != ma.utils._Missing:
        fr_field_parameters["default"] = value.missing

    return fr_field_parameters

kreathon avatar Jan 13 '22 16:01 kreathon