Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Deprecated function used in JavaScript and TypeScript generators #15938

Open
4 of 6 tasks
possan opened this issue Jun 27, 2023 · 1 comment
Open
4 of 6 tasks

[BUG] Deprecated function used in JavaScript and TypeScript generators #15938

possan opened this issue Jun 27, 2023 · 1 comment

Comments

@possan
Copy link
Contributor

possan commented Jun 27, 2023

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The current JavaScript and TypeScript generators use substr to get the date part (YYYY-MM-DD) from a full ISO-8601 date string, substr is deprecated and there is a substring function that is supported and that should be used instead.

Using deprecated functions might blocked by your build system.

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr

Screenshot 2023-06-27 at 11 44 27

openapi-generator version

Tested 6.6.0 and Master - Not a regression

Steps to reproduce

Generate any spec file containing a date field, the code generated is:

httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
Related issues/PRs

Found no issue or PR mentioning this

Suggest a fix

Draft PR: #15937

@possan
Copy link
Contributor Author

possan commented Jun 29, 2023

PR was merged #15937

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

No branches or pull requests

1 participant