-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
json deserialization into int64 can fail using patch, UnstructuredJSONScheme, or json.Unmarshal #5557
Comments
Might just be 15651 |
Aka #5536 |
@smarterclayton Please provide the text of the problem in this issue. |
I can reproduce this locally using a template and the new-app command. In my case it appears that when the processedTemplate is retrieved it is being sent back to the client as a floating point number which then cannot unmarshal. "securityContext":{"supplementalGroups":[1.000030003e+09]} template and request/response log: https://gist.github.com/pweil-/1cb8cf06e19f2cc0a102 I found this issue golang/go#5562 cc @pmorie |
@liggitt - word on the street is you are a Marshal expert ^ |
I am skilled in marshal arts... will take a look asap |
is this actually p2? if so, I'll take a look later |
Looks like |
p1 because it can wedge the server, unless we eliminate the possibility that it doesn't happen again. |
Actually, the problem is that the encoder is producing the wrong output. From @pweil-'s gist, the response from the API server from a POST is wrong. |
I can recreate this in process template, might be related to RawExtension |
Issue is this line:
which decodes all numbers as float64 |
Go JSON doesn't understand int64, right? On Fri, Nov 6, 2015 at 4:21 PM, Jordan Liggitt [email protected]
|
When deserializing to an unstructured map, it either puts all numbers into float64 (today's behavior, which flips integers to floating point in weird cases), or you can set UseNumber() on the json decoder, which stores all numbers internally as strings, gives you |
The root issue is that the unstructured serialization doesn't have the type information to make the right serialization choices. It's tough to imagine a good way to solve this, unless you basically look up the type information by picking through the template output (which might not even be an object). |
We can normalize all float64 into their compact representation (1e3 -> On Nov 6, 2015, at 4:38 PM, Jordan Liggitt [email protected] wrote: When deserializing to an unstructured map, it either puts all numbers into — |
Doing anything to all the number values requires walking the JSON tree. If I was going to do that, I'd rather deserialize losslessly (jsonDecoder.UseNumber()) and walk the tree converting to either int64 or float64 as appropriate |
If you deserialize with UseNumber don't you lose whether the original value On Nov 6, 2015, at 5:05 PM, Jordan Liggitt [email protected] wrote: Doing anything to all the number values requires walking the JSON tree. If — |
no, strings are always strings in JSON, UseNumber turns unquoted numbers into json.Number |
Ok sorry. Yes, that is better. On Nov 6, 2015, at 5:10 PM, Jordan Liggitt [email protected] wrote: no, strings are always strings in JSON, UseNumber turns unquoted numbers — |
This impacts patch (not used a lot now, but will be with |
https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6517/consoleText
The text was updated successfully, but these errors were encountered: