Open maratal opened 2 years ago
Originated from https://github.com/ably/ably-cocoa/pull/1405#discussion_r872292403 @QuintinWillison @lawrence-forooghian
I was trying to put this new property into the documentation, but after inspecting docs sources structure some questions were raised on jsonData
implementation. These are possible types for data
in /ably-docs/content/realtime/messages.textile
:
default: String, StringBuffer, JSON Object
java: String, ByteArray, JSONObject, JSONArray
csharp: String, byte[], plain C# object that can be serialized to JSON
ruby: String, Binary (ASCII-8BIT String), Hash, Array
python: String, Bytearray, Dict, List
php: String, Binary String, Associative Array, Array
objc: NSString *, NSData *, NSDictionary *, NSArray *
swift: String, NSData, Dictionary, Array
flutter: String, Map, List
And if c#
has this "plain C# object that can be serialized to JSON" which is similar to NSData
for Objective-C
and Swift
in this case, then how it should behave in other languages? Fallback to just String
? Or maybe it's just not needed in other languages? @lawrence-forooghian @QuintinWillison
Can we leave that for individual implementations to decide? We can say that they should use whatever type is most appropriate in that language for representing raw binary data. The existing IDL makes a couple of references to a type called Binary
(which it doesn't actually define as far as I can see), perhaps we could use that type?
My understanding of "plain C# object that can be serialized to JSON" is that it is not similar to NSData
in Objective-C/Swift. In the Objective-C case, an NSData
instance is classically the carrier of JSON-encoded data, as accepted by NSJSONSerialization
's JSONObjectWithData:options:error:
method which returns a 'Foundation object' which renders the following translations:
Input JSON | Output Foundation Object |
---|---|
object |
NSDictionary instance |
array |
NSArray instance |
string value |
NSString instance |
number value |
NSNumber instance |
true or false |
NSNumber instance |
null |
NSNull singleton |
So, I wonder if there's some conflation of concepts here. I'm a little confused as to what the question that's being asked is. 😕
➤ Automation for Jira commented:
The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-2757
Currently message object contains
data
field, which is described as:In addition to that, message should contain (if applicable) JSON data field, ready to be parsed into platform specific object.
┆Issue is synchronized with this Jira Task by Unito