On Mon, Jul 18, 2016 at 6:29 AM, [email protected] <[email protected]> wrote: > > On 2016-07-15 21:32 (+0100), Robert Dale <[email protected]> wrote: >> Responding to Marko and Kevin... [...] >> >> Kevin wrote: >> >> Correct, these types weren't relevant... I only wanted to show you the >> >> format... >> > However, I don't manage to understand the structure behind the format you >> > suggest, and I don't manage to establish a clear explicit representation >> > in my mind, regarding the example you provided in the TP-1274 PR. Could >> > you please give an example of how you would imagine the serialized JSON of >> > : >> > - an example list of typed values, like List<UUID> >> > - an example list of typed and untyped values, like a list with UUIDs and >> > booleans >> > - an example map of typed and untyped values >> > >> > How would you define that format in a general way ? Like what I did when >> > saying >> > "- untyped : value >> > - typed : {"@type", "typeName", "value" : value}" >> > >> > Just trying your point better. >> > Also what are the downsides you see with the format suggested above ? >> >> The original format was in a list. I must have missed where you >> accepted this format. In any case, like I originally stated, if you >> want strong-typing, then _everything_ must be an _object_. >> >> Here's an example of non-typed: >> https://gist.github.com/robertdale/02931f5633be55a59c13bca3b0e58655 >> - native json only >> >> Here's strongly typed: >> https://gist.github.com/robertdale/6c074b165a72efee701e26f851f8b68a >> - set (as an object), list (as an object), mixed-type lists, etc >> > > OK, glad to see your revised version of the format is the exact same I > defined initially. I think we're on the same page here now. Except one thing, > it seems like the type information for vertex is not consistent with the > rest, if as you say if "everything is an object", then it would be like this > : https://gist.github.com/newkek/2d748dc59029f01af18b2a0e80494a31 . > However, strong typing does not necessarily mean to me that there needs to be > a type metadata if the type is already properly handled by JSON. I.e. I don't > see the necessity to add type information for data like boolean. There is no > ambiguity possible.
Vertex (etc) is already an object so no it doesn't need to be nested inside another object. The "type, value" pattern is primarily for scalars but can also be used to differentiate collections - sets, lists, arrays, etc. I got carried away with typing on boolean. I think the last item I disagree on is having a default type for integers. I think they should all be typed. Otherwise, I agree we're on the same page. [...] > No, in DSE Graph, the schema has to be defined upfront and does not depend on > the first element inserted. But I'm not the best person to talk about that > and I'm not sure this is the right place.. Specifically, "developer" mode allows this. "Production" mode requires schema. -- Robert Dale
