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

longinteger values cannot receive a string input in server-owned interfaces #967

Open
rbino opened this issue Jul 2, 2024 · 0 comments · Fixed by #969
Open

longinteger values cannot receive a string input in server-owned interfaces #967

rbino opened this issue Jul 2, 2024 · 0 comments · Fixed by #969

Comments

@rbino
Copy link
Collaborator

rbino commented Jul 2, 2024

longinteger values are exposed as strings by default by AppEngine API since they are 64 bit integers and JSON is only able to represent ~53 bit integers at most since all numbers are double.

This means that we should also accept integer values as input (since they are the only way to send longinteger values bigger than 53 bits with a JSON), but we currently don't.

Sketch of the fix

Add another clause to cast_value here which more or less does this:

  defp cast_value(:longinteger, string_value) when is_binary(string_value) do
    # Try to parse the value as integer, return `{:ok, int_value}` or `{:error, :unexpected_value_type}`
  end

  defp cast_value(:longintegerarray, string_values) do
    # Similar but for an array of values. Map over them and return an `{:ok, list_of_ints}` or an error tuple.
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant