Skip to content

[REQ] [rust] map format: date to chrono::naive::NaiveDate for rust-server generator #9769

@seiyab

Description

@seiyab

Is your feature request related to a problem? Please describe.

According OpenAPI Specification, format: date for type: string is As defined by full-date - RFC3339.
That is defined as date-fullyear "-" date-month "-" date-mday (RFC3339), like 2021-06-15.
So it doesn't have time and timezone information.

However, rust-server generator maps format: date to chrono::DateTime::<chrono::Utc>, that has time and timezone information.
We are forced to add provisional time like 00:00:00 and timezone like Utc to make dates to be chrono::DateTime::<chrono::Utc>.

Describe the solution you'd like

Adding an option to mapformat: date to chrono::naive::NaiveDate.
Though I think the current behavior is not desire, changing the API causes serious backward incompatibility. It should be added as opt-in approach.
I think NaiveDate is more appropriate than chrono::Date since full-date doesn't have a timezone information.

Describe alternatives you've considered

I don't have any other ideas.

Additional context

Nothing.
I'll add information if community / maintainers need more description.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions