Skip to content

Support of DateTime and Date formats#937

Closed
expobrain wants to merge 1 commit into
marshmallow-code:devfrom
expobrain:datetime_custom_format
Closed

Support of DateTime and Date formats#937
expobrain wants to merge 1 commit into
marshmallow-code:devfrom
expobrain:datetime_custom_format

Conversation

@expobrain

Copy link
Copy Markdown

Adds full support for rendering Date and DateTime Marshmallow fields with each of their format values.

This solve the issue of Date and DateTime with a non-default format being rendered with format: null instead of format: date and format: date-time respectively.

@expobrain expobrain changed the title Supoort of DateTime and Date formats Support of DateTime and Date formats Sep 2, 2024
@expobrain
expobrain marked this pull request as draft September 2, 2024 22:05

@lafrech lafrech left a comment

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.

Hi. Thanks for digging into this.

I didn't take to time to review thoroughly but here's a question already.

Any idea why it stopped working as expected in version 6.4?

"example": "1676451277514.654",
"min": "0",
}
elif field.format is not None:

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.

At this point, field.format can't be None due to line 549, right?

@bhperry

bhperry commented Sep 26, 2024

Copy link
Copy Markdown

Also, format and pattern should not ever by None, according to openapi spec they must be strings. Probably should be removed from the ret dict when they are None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants