OpenAPITools / OpenAPITools/openapi-generator

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

Open
#9,769 3 comments 1 reaction 1 assignee View on GitHub

@richardwhiuk is already working on this.

Since Jun 16, 2021.

Enhancement: Feature Server: Rust
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.