KalleOlaviNiemitalo commented on code in PR #1826:
URL: https://github.com/apache/avro/pull/1826#discussion_r944321962
##########
lang/c++/test/unittest.cc:
##########
@@ -452,7 +457,14 @@ struct TestSchema {
customAttributes);
std::string expectedJsonWithCustomAttribute =
"{\"type\": \"record\", \"name\": \"Test\",\"fields\": "
- "[{\"name\": \"f1\", \"type\": \"long\",\"extra field\": \"1\"}]}";
+ "[{\"name\": \"f1\", \"type\": \"long\", "
+ "\"arrayField\": \"[1]\", "
+ "\"booleanField\": \"true\", "
+ "\"mapField\": \"{\\\"key1\\\":\\\"value1\\\",
\\\"key2\\\":\\\"value2\\\"}\", "
+ "\"nullField\": \"null\", "
+ "\"numberField\": \"1.23\", "
+ "\"stringField\": \"\\\"field value with \\\"double quotes\\\"\\\"\""
Review Comment:
As in <https://github.com/apache/avro/pull/1821#discussion_r943586881>, I
think this should be
```suggestion
"[{\"name\": \"f1\", \"type\": \"long\", "
"\"arrayField\": [1], "
"\"booleanField\": true, "
"\"mapField\": {\"key1\":\"value1\", \"key2\":\"value2\"}, "
"\"nullField\": null, "
"\"numberField\": 1.23, "
"\"stringField\": \"field value with \\\"double quotes\\\"\""
```
i.e. CustomAttributes.printJson should assume that the `std::string` values
are already in JSON format, and write them out without adding any quotation
marks around them or backslashes within them. Likewise, callers of
CustomAttributes::addAttribute (especially in Compiler.cc) should provide a
JSON-format `std::string`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]