Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog
unreleased
**********

Bug fixes:

- ``MarshmallowPlugin``: Emit ``minimum: 0`` rather than the non-standard
``min: "0"`` for ``DateTime`` fields with the ``"timestamp"`` and
``"timestamp_ms"`` formats (:issue:`1064`).

Other changes:

- Drop support for marshmallow 3, which is EOL.
Expand Down
4 changes: 2 additions & 2 deletions src/apispec/ext/marshmallow/field_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,14 @@ def datetime2properties(self, field, **kwargs: typing.Any) -> dict:
"type": "number",
"format": "float",
"example": "1676451245.596",
"min": "0",
"minimum": 0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be

"minimum": "0",

@ULisichkin ULisichkin Aug 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, the value "0" is invalid and causes the validator to fail, as I already mentioned in the opened Issue.
See example https://spec.openapis.org/oas/v3.0.2#simple-model

}
elif field.format == "timestamp_ms":
ret = {
"type": "number",
"format": "float",
"example": "1676451277514.654",
"min": "0",
"minimum": 0,
}
else:
ret = {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ext_marshmallow_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_datetime2property_timestamp(spec_fixture):
assert res == {
"type": "number",
"format": "float",
"min": "0",
"minimum": 0,
"example": "1676451245.596",
}

Expand All @@ -602,7 +602,7 @@ def test_datetime2property_timestamp_ms(spec_fixture):
assert res == {
"type": "number",
"format": "float",
"min": "0",
"minimum": 0,
"example": "1676451277514.654",
}

Expand Down