Sam Okrent has posted comments on this change. Change subject: Add json builder utility ......................................................................
Patch Set 3: (5 comments) http://gerrit.cloudera.org:8080/#/c/7387/3/src/kudu/util/easy_json.h File src/kudu/util/easy_json.h: PS3, Line 31: : // rapidjson::Document d; : // rapidjson::Value v; : // v.SetObject(); : // rapidjson::Value list; : // list.SetArray(); : // v.AddMember("list", list, d.GetAllocator()); : // v["list"].PushBack(rapidjson::Value().SetString("element"), d.GetAllocator()); > style nit: can you indent these code examples by a couple spaces, like: Done Line 41: > nit: get rid of this extra space, or put a // on it Done Line 43: // ej["list"][0] = "element"; > is this usage dangerous? eg I'm afraid it ends up resulting in code like: If we're just considering the context of Mustache templates, a missing key is treated the same way as an empty array. A template might look like: {{#name_of_array}} <p>{{element_attribute}}</p> {{/name_of_array}} And if 'name_of_array' doesn't exist, that section just doesn't get rendered. Does that change your mind at all, or should I still enforce SetArray/Object()? PS3, Line 74: amongst > "among" Done Line 86: rapidjson::Value value_; > hm, what's this top-level value for? isn't that already stored in the top-l No EasyJson object owns it's underlying value, instead they all have pointers to a value tree owned by an EasyJsonAllocator, which is shared between all EasyJson objects -- To view, visit http://gerrit.cloudera.org:8080/7387 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie195b06c5ba67af3043d2032c56b90c1a85f641a Gerrit-PatchSet: 3 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Sam Okrent <[email protected]> Gerrit-Reviewer: Andrew Wong <[email protected]> Gerrit-Reviewer: Dan Burkert <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Sam Okrent <[email protected]> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <[email protected]> Gerrit-HasComments: Yes
