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

AppEngine: longinteger values can't be returned as string for some interface combinations #630

Closed
rbino opened this issue Nov 22, 2021 · 1 comment
Labels
API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application minor This issue causes only minor annoyance to the user user experience This issue is about user experience

Comments

@rbino
Copy link
Collaborator

rbino commented Nov 22, 2021

AppEngine API supports passing some options that control how longinteger values are represented in JSON, due to the fact that 64 bit integer values are not theoretically representable using JSON numbers (since they're 64 floating point values, and the mantissa can only represent 52 bits) and some JSON decoders could fail if they encounter integers > 2^52.

To prevent that, longinteger values are returned as string by default, and it's possible to pass allow_bigintegers=true as query parameters to always render them as integers, or allow_safe_bigintegers to only render as integers the values which are < 2^52 (see here).

Currently though there are two cases where the behaviour is inconsistent: when querying the root of an individual datastream interface and querying the root of an individual properties interface. Both those cases force longinteger values to be rendered as integers, and they ignore the passed options.

It should be possible to optionally change the current behaviour with query parameters, possibly leaving the current default as-is (even if it's inconsistent with the rest) to avoid API breaking changes.

@rbino rbino added API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application user experience This issue is about user experience minor This issue causes only minor annoyance to the user labels Nov 22, 2021
@Annopaolo
Copy link
Collaborator

Closed by #687.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application minor This issue causes only minor annoyance to the user user experience This issue is about user experience
Projects
None yet
Development

No branches or pull requests

2 participants