Forum Discussion

Bloumb's avatar
Bloumb
Occasional Visitor
3 years ago

Swagger UI quoted vs unquoted longs

When I am entering int64/long values into the swagger UI it seems after a certain amount of digits the lower order values start to get corrupted.  Here's an example:

 

While the value I'm using in productStructureKey ends in 17 the payload converts this to 20 when sending to my application.  Interestingly when I wrap it in quotes the correct value works:

 

 

With the quoted value of the long the correct value is sent.  Here's the model for the relevant section:

 

instrumentFilter{
productStructureKey*integer($int64)
}
expirationDatestring($date)

 

Is this expected behavior or a bug with the generated UI?  Do big values for longs need to be quoted to be sent correctly using the UI? 

  • It's a known issue caused by JavaScript limitations. These large numbers fall outside of JavaScript/JSON number range, that's why they are getting rounded. See this discussion for details:

    https://github.com/swagger-api/swagger-ui/issues/2030

     

    The suggested solution is to transfer large numbers as strings (i.e. change the type from integer to string).

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    It's a known issue caused by JavaScript limitations. These large numbers fall outside of JavaScript/JSON number range, that's why they are getting rounded. See this discussion for details:

    https://github.com/swagger-api/swagger-ui/issues/2030

     

    The suggested solution is to transfer large numbers as strings (i.e. change the type from integer to string).