swagger-api / swagger-api/swagger-ui

Support for integers larger than i32

Open
#10,049 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: [e.g. macOS] Windows 11
  • Browser: [e.g. chrome, safari] Brave
  • Version: [e.g. 22] 5.17.14
  • Method of installation: [e.g. npm, dist assets] dist assets
  • Swagger-UI version: [e.g. 3.10.0] 5.17.14
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0] 3.0
Describe the bug you're encountering

I am sending big numbers over my api and everything bigger than i32 gets wrongly displayed.
For example in my db the number is: 60503861139345408 but swagger-ui displays: 60503861139345410

To reproduce...

Steps to reproduce the behavior:

  1. serve large numbers over your api
  2. see what swagger-ui displays
Expected behavior

Display the correct number

Screenshots

//

Additional context or thoughts

I found this comment but I think this is right.
If I want to serve big numbers over my api swagger-ui should not be the limiting factor.

I understand that their is no correct way to serialize BigInts to Json but at the end the shown json file is just a string that is shown so I should be possible to serialize it to a string and remove the " right?

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

Reproduce the issue with Swagger UI 5.17.14 and an OpenAPI 3.0 API response containing 60503861139345408. Locate the response-display path responsible for numeric values and any existing coverage around it; done means the UI displays the exact integer without rounding, while preserving normal number rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.