OpenAPITools / OpenAPITools/openapi-generator
[REQ] Lossless JSON parsing for JavaScript generated libraries.
Nobody has claimed this yet.
- 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.
When creating an API client using the JavaScript generator, when parsing JSON data with large integers and converting data types, such as:
{ "id" : "21473794133340466" }
The data tends to get misrepresented (that particular number turns into 21473794133340464), as JavaScript is bad at handling large integers, this happens when the parsed body is returned using superagent. This is a pretty well known problem and many JSON parsing libraries exist that implement special classes for this case.
Describe the solution you'd like
It would be great if the default request body parsing would implement something like this or at least allow for a flag to be added to the generator that would enable such a feature.
Describe alternatives you've considered
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the JavaScript generator's default superagent response-body parsing and review the requested lossless-json approach or generator flag. Use the large-integer example from the issue to verify that parsing preserves the original value, and ensure the selected behavior is covered by an appropriate generator test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100