allow null data - valid if at least one attribute exists#31
allow null data - valid if at least one attribute exists#31pdeglopper wants to merge 1 commit intospotify:masterfrom pdeglopper:master
Conversation
Codecov Report
@@ Coverage Diff @@
## master #31 +/- ##
============================================
+ Coverage 75.83% 76.28% +0.44%
- Complexity 189 191 +2
============================================
Files 25 25
Lines 894 894
Branches 59 59
============================================
+ Hits 678 682 +4
+ Misses 183 181 -2
+ Partials 33 31 -2
Continue to review full report at Codecov.
|
|
Silently changing |
|
The down side there is that as far as I can tell a message could validly contain either the empty string or null as data, so treating them identically when serializing makes the serializing and then deserializing not the identity function. That's an edge case, but null data is something the google API spec and command line tools allow so existing code probably shouldn't be assuming it. I don't feel very strongly about it, though. |
|
Docs are a bit vague but they seem to indicate that empty data is treated same as null data. So might be fine for us to represent null data as empty data. https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage |
|
Pubsub seems to treat messages where (1) Thus it would seem safe for this client to represent null/absent |
This should be enough to enable deserializing messages that omit the data field, which appears to be valid if there's at least one attribute set.
I don't really have the insight at present into the ways this client is used to send events to say whether or not it needs to validate that one of those two is set before building the message.