swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

BUG: Long values displayed incorrectly in json response

Open devmsaleh opened this issue 7 years ago • 2 comments

hi, i am using following dependencies

<dependency>
		    <groupId>io.springfox</groupId>
		    <artifactId>springfox-swagger2</artifactId>
		    <version>2.7.0</version>
		</dependency>
		
		<dependency>
		    <groupId>io.springfox</groupId>
		    <artifactId>springfox-swagger-ui</artifactId>
		    <version>2.7.0</version>
		</dependency>
		
		
		<dependency>
		    <groupId>io.swagger</groupId>
		    <artifactId>swagger-jersey2-jaxrs</artifactId>
		    <version>1.5.17</version>
		</dependency>

when i am making a get request with postman as follows: http://localhost:8081/hai/api/v1/findDonatorOldProjects/100000000000000614

i get the response correctly as follows:

{
    "errorCode": "SUCCESS_CODE",
    "errorCodeDesc": "تمت العملية نجاح",
    "errorCodeValue": 0,
    "response": {
        "data": [
            {
                "id": 100000000000001478,
                "name": "الرغيف الخير - الأردن"
            }
        ]
    }
}

but when i make the request with swagger ui, i get the following response

{
  "errorCode": "SUCCESS_CODE",
  "errorCodeDesc": "تمت العملية نجاح",
  "errorCodeValue": 0,
  "response": {
    "data": [
      {
        "id": 100000000000001470,
        "name": "الرغيف الخير - الأردن"
      }
    ]
  }
}

the long value 100000000000001478 is displayed incorrectly as 100000000000001470

devmsaleh avatar Jan 06 '18 21:01 devmsaleh

Same problem here! I use springdoc-openapi library (uses swagger-core internally) and faced with this issue. But when I started investigate it the discussion with the maintainer brings me to this issue.

See: https://github.com/springdoc/springdoc-openapi/issues/2174

kuza2010 avatar Jun 03 '23 15:06 kuza2010

This is because js has right bound: 2^(53)-1 and java: 2^(63)-1. Seems nothing that we can really do here.

kuza2010 avatar Jun 05 '23 11:06 kuza2010