Closed coandco closed 1 year ago
Hey, @coandco thanks for posting this issue. I will take a look at it.
As for casting everything to string, AFAIK specifically for Android config, there was (I will re-check that) a hard requirement to have every value cast to a string which then could be parsed adequately on the client side (Android device). Any request that I attempted to assemble using an attribute with a type different from the string
failed with error like the wrong payload. For the null
I am not sure, I will need to check that first, perhaps it's safe to exempt it.
As documentation states, the data should contain the only string, so that requirement is still valid. Also please take a look at the doc string for this attribute https://github.com/healthjoy/async-firebase/blob/master/async_firebase/client.py#L190
Will just put here several options that we should consider for the data
field keys and values representation if the value is missing:
"None"
and may change it to "null"
- I don't feel this is a good option though)@akalex we could try the latter two, what do you think?
@ndmytro Thanks for putting a couple of options together, I will need to do a quick test but I guess changing None
to "null"
should be the best option, in that case on the Firebase side the value will be parsed into null
which I think is the expected result.
Describe the bug All data values are getting converted to string in the payload, even None/null. There's no way to send
data={"foo": null}
as a payload.To Reproduce
This results in the following message being sent:
Expected behavior I'd expect the message generated to look like this:
Screenshots N/A
Additional context It looks like the issue is https://github.com/healthjoy/async-firebase/blob/master/async_firebase/client.py#L218, which explicitly casts every value in the
data
key to a string. Could this be changed to remove the cast, or at least exempt nulls from it? The whole point of thedata
key is to be able to pass arbitrary JSON data to your application and let the app interpret it how you wish. Force-converting everything to string makes it impossible to send some valid JSON messages.