OpenAPITools / OpenAPITools/openapi-generator

[REQ] Support Temporal for typescript(-angular)

Open
#22,674 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
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.

Date time has been a mess so far, with JS as the Date type just has tons of issues. (For example no equivalent to OffsetDateTime exists). Some mappings from the OpenAPI spec can't currently be properly done with this API.

Describe the solution you'd like

Temporal has been introduced as a new standard API across the web to fix this issue. It now ships in 2/3 major browser engines, Firefox since like the better part of a year now and Chromium since last week (currently rolling out to users) and Apple also has some... let's call them beginnings going in their TP apparently (not an issue for me, but a polyfill is available until auch time as they get it done properly).

Ideally it'd be introduced as an option for now and should probably be made default with the next major release, given Apple get's their stuff together in time (I'd imagine many need to support Apple stuff).

This would allow proper mapping of the following formats (from the format registry):

  • date-time: Temporal.ZonedDateTime
  • date-time-local: Temporal.PlainDateTime
  • date: Temporal.PlainDate
  • time: Temporal.PlainTime
  • possibly unixtimestamp: Temporal.Instant

Describe alternatives you've considered

Manually converting everything after the fact, but that gets annoying and very boilerplate-y very fast. Also some stuff ist just lost forever any can't be recovered. If an RFC3339 date is converted into a date, it's offset is lost forever as Date has no notion of timezones or anything similar.

Additional context

https://jsdate.wtf/
https://caniuse.com/temporal
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

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.

Research direction

Start at the typescript and typescript-angular generator entry points and trace how OpenAPI date and time formats are mapped to client types. Compare the requested Temporal mappings with current generated output and existing generator tests; done means the option works for the listed formats and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.