Changelog¶
0.15.0 (2023-04-05)¶
Changes to supported software versions.
python3.6 or later and marshmallow>=3.0.0 are now required
Add support for python3.11
For
sqlalchemy
integration, marshmallow-sqlalchemy>=0.28.2 and flask-sqlalchemy>=3.0.0 are now required
Backwards-incompatible:
URLFor
andAbsoluteURLFor
now do not accept parameters forflask.url_for
as top-level parameters. They must always be passed in thevalues
dictionary, as explained in the v0.14.0 changelog.
Bug fixes:
Address distutils deprecation warning in Python 3.10 (#242). Thanks @GabrielLins64 for the PR.
0.14.0 (2020-09-27)¶
Add
values
argument toURLFor
andAbsoluteURLFor
for passing values toflask.url_for
.
This prevents unrelated parameters from getting passed (#52, #67). Thanks @AlrasheedA for the PR.
Deprecation:
Passing params to
flask.url_for
viaURLFor
’s andAbsoluteURLFor
’s constructor params is deprecated. Passvalues
instead.
# flask-marshmallow<0.14.0
class UserSchema(ma.Schema):
_links = ma.Hyperlinks(
{
"self": ma.URLFor("user_detail", id="<id>"),
}
)
# flask-marshmallow>=0.14.0
class UserSchema(ma.Schema):
_links = ma.Hyperlinks(
{
"self": ma.URLFor("user_detail", values=dict(id="<id>")),
}
)
0.13.0 (2020-06-07)¶
Bug fixes:
Fix compatibility with marshmallow-sqlalchemy<0.22.0 (#189). Thanks @PatrickRic for reporting.
Other changes:
Remove unused
flask_marshmallow.sqla.SchemaOpts
.
0.12.0 (2020-04-26)¶
Breaking change:
ma.ModelSchema
andma.TableSchema
are removed, since these are deprecated upstream.
Warning
It is highly recommended that you use the newer ma.SQLAlchemySchema
and ma.SQLAlchemyAutoSchema
classes
instead of ModelSchema
and TableSchema
. See the release notes for marshmallow-sqlalchemy 0.22.0
for instructions on how to migrate.
If you need to use ModelSchema
and TableSchema
for the time being, you’ll need to import these directly from marshmallow_sqlalchemy
.
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/test.db"
db = SQLAlchemy(app)
ma = Marshmallow(app)
# flask-marshmallow<0.12.0
class AuthorSchema(ma.ModelSchema):
class Meta:
model = Author
# flask-marshmallow>=0.12.0 (recommended)
class AuthorSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Author
load_instance = True
# flask-marshmallow>=0.12.0 (not recommended)
from marshmallow_sqlalchemy import ModelSchema
class AuthorSchema(ModelSchema):
class Meta:
model = Author
sql_session = db.session
Bug fixes:
0.11.0 (2020-02-09)¶
Features:
Add support for
SQLAlchemySchema
,SQLAlchemyAutoSchema
, andauto_field
from marshmallow-sqlalchemy>=0.22.0 (#166).
Bug fixes:
Properly restrict marshmallow-sqlalchemy version based on Python version (#158).
Other changes:
Test against Python 3.8.
0.10.1 (2019-05-05)¶
Bug fixes:
marshmallow 3.0.0rc6 compatibility (#134).
0.10.0 (2019-03-09)¶
Features:
Add
ma.TableSchema
(#124).SQLAlchemy requirements can be installed with
pip install 'flask-marshmallow[sqlalchemy]'
.
Bug fixes:
URLFor
,AbsoluteURLFor
, andHyperlinkRelated
serialize toNone
if a passed attribute value isNone
(#18, #68, #72). Thanks @RobinRamuel, @ocervell, and @feigner for reporting.
Support:
Test against Python 3.7.
Drop support for Python 3.4. Only Python 2.7 and >=3.5 are supported.
0.9.0 (2018-04-29)¶
Add support for marshmallow 3 beta. Thanks @SBillion for the PR.
Drop support for Python 3.3. Only Python 2.7 and >=3.4 are supported.
Updated documentation to fix example
ma.URLFor
target.
0.8.0 (2017-05-28)¶
Fix compatibility with marshmallow>=3.0.
Support:
Backwards-incompatible: Drop support for marshmallow<=2.0.0.
Test against Python 3.6.
0.7.0 (2016-06-28)¶
many
argument toSchema.jsonify
defaults to value of theSchema
instance’smany
attribute (#42). Thanks @singingwolfboy.Attach
HyperlinkRelated
toMarshmallow
instances. Thanks @singingwolfboy for reporting.
Support:
Upgrade to invoke>=0.13.0.
Updated documentation to reference
HyperlinkRelated
instead ofHyperlinkModelSchema
. Thanks @singingwolfboy.Updated documentation links to readthedocs.io subdomain. Thanks @adamchainz.
0.6.2 (2015-09-16)¶
Fix compatibility with marshmallow>=2.0.0rc2.
Support:
Tested against Python 3.5.
0.6.1 (2015-09-06)¶
Fix compatibility with marshmallow-sqlalchemy>=0.4.0 (#25). Thanks @svenstaro for reporting.
Support:
Include docs in release tarballs.
0.6.0 (2015-05-02)¶
Features:
Add Flask-SQLAlchemy/marshmallow-sqlalchemy support via the
ModelSchema
andHyperlinkModelSchema
classes.Schema.jsonify
now takes the same arguments asmarshmallow.Schema.dump
. Additional keyword arguments are passed toflask.jsonify
.Hyperlinks
field supports serializing a list of hyperlinks (#11). Thanks @royrusso for the suggestion.
Deprecation/Removal:
Remove support for
MARSHMALLOW_DATEFORMAT
andMARSHMALLOW_STRICT
config options.
Other changes:
Drop support for marshmallow<1.2.0.
0.5.1 (2015-04-27)¶
Fix compatibility with marshmallow>=2.0.0.
0.5.0 (2015-03-29)¶
Backwards-incompatible: Remove
flask_marshmallow.SchemaOpts
class and remove support forMARSHMALLOW_DATEFORMAT
andMARSHMALLOW_STRICT
(#8). Prevents aRuntimeError
when instantiating aSchema
outside of a request context.
0.4.0 (2014-12-22)¶
Backwards-incompatible: Rename
URL
andAbsoluteURL
toURLFor
andAbsoluteURLFor
, respectively, to prevent overriding marshmallow’sURL
field (#6). Thanks @svenstaro for the suggestion.Fix bug that raised an error when deserializing
Hyperlinks
andURL
fields (#9). Thanks @raj-kesavan for reporting.
Deprecation:
Schema.jsonify
is deprecated. Useflask.jsonify
on the result ofSchema.dump
instead.The
MARSHMALLOW_DATEFORMAT
andMARSHMALLOW_STRICT
config values are deprecated. Use a baseSchema
class instead (#8).
0.3.0 (2014-10-19)¶
Supports marshmallow >= 1.0.0-a.
0.2.0 (2014-05-12)¶
Implementation as a proper class-based Flask extension.
Serializer and fields classes are available from the
Marshmallow
object.
0.1.0 (2014-04-25)¶
First release.
Hyperlinks
,URL
, andAbsoluteURL
fields implemented.Serializer#jsonify
implemented.