Skip to content

Commit

Permalink
Merge pull request #742 from marshmallow-code/ma_3.24
Browse files Browse the repository at this point in the history
Require marshmallow 3.24
  • Loading branch information
lafrech authored Jan 7, 2025
2 parents 142eb67 + ede7234 commit 7646f67
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
18 changes: 2 additions & 16 deletions docs/openapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,9 @@ schema `properties`. Although objects are not ordered in JSON, OpenAPI
graphical interfaces tend to respect the order in which the `properties` are
defined in the ``properties`` object in the specification file.

When using an ordererd ``Schema``, the fields definition order is preserved
when generating the specification file and the `properties` are displayed in
that order.
``Schema`` classes keep fields in declaration order, and this order is preserved when
generating the specification file: the `properties` are displayed in that order.

This is typically done in a base class:

.. code-block:: python
:emphasize-lines: 2,3
class MyBaseSchema(ma.Schema):
class Meta:
ordered = True
class User(MyBaseSchema):
name = ma.fields.String()
surname = ma.fields.String()

Serve the OpenAPI Documentation
-------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requires-python = ">=3.9"
dependencies = [
"werkzeug>=3.0.1,<4",
"flask>=3.0.2,<4",
"marshmallow>=3.18.0,<4",
"marshmallow>=3.24.1,<4",
"webargs>=8.0.0,<9",
"apispec[marshmallow]>=6.0.0,<7",
]
Expand All @@ -50,7 +50,7 @@ tests = [
"coverage==7.6.10",
"werkzeug==3.1.3",
"flask==3.1.0",
"marshmallow==3.23.2",
"marshmallow==3.24.1",
"webargs==8.6.0",
"apispec==6.8.0",
"PyYAML==6.0.2",
Expand Down
4 changes: 0 additions & 4 deletions src/flask_smorest/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class PaginationParametersSchema(ma.Schema):
"""Deserializes pagination params into PaginationParameters"""

class Meta:
ordered = True
unknown = ma.EXCLUDE

page = ma.fields.Integer(
Expand Down Expand Up @@ -127,9 +126,6 @@ class PaginationMetadataSchema(ma.Schema):
previous_page = ma.fields.Int()
next_page = ma.fields.Int()

class Meta:
ordered = True


PAGINATION_HEADER = {
"description": "Pagination metadata",
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class DocSchema(CounterSchema):

class QueryArgsSchema(ma.Schema):
class Meta:
ordered = True
unknown = ma.EXCLUDE

arg1 = ma.fields.String()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def dumps(self, obj, **kwargs):
return json.dumps(obj, **kwargs, cls=CustomJSONEncoder)

class CustomSchema(ma.Schema):
custom_field = ma.fields.Field(load_default=CustomType())
custom_field = ma.fields.Raw(load_default=CustomType())

app.config["OPENAPI_VERSION"] = openapi_version
app.json = CustomJsonProvider(app)
Expand Down

0 comments on commit 7646f67

Please sign in to comment.