Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The following table lists the serialization formats currently supported by refle
| BSON | [libbson](https://github.com/mongodb/mongo-c-driver) | >= 1.25.1 | Apache 2.0 | JSON-like binary format |
| Cap'n Proto | [capnproto](https://capnproto.org) | >= 1.0.2 | MIT | Schemaful binary format |
| CBOR | [jsoncons](https://github.com/danielaparker/jsoncons)| >= 0.176.0 | BSL 1.0 | JSON-like binary format |
| CSV | [Apache Arrow](https://arrow.apache.org/) | >= 21.0.0 | Apache 2.0 | Tabular textual format |
| flexbuffers | [flatbuffers](https://github.com/google/flatbuffers) | >= 23.5.26 | Apache 2.0 | Schema-less version of flatbuffers, binary format |
| msgpack | [msgpack-c](https://github.com/msgpack/msgpack-c) | >= 6.0.0 | BSL 1.0 | JSON-like binary format |
| parquet | [Apache Arrow](https://arrow.apache.org/) | >= 21.0.0 | Apache 2.0 | Tabular binary format |
Expand Down Expand Up @@ -245,7 +246,7 @@ std::cout << "Hello, my name is " << homer2.first_name() << " "

### Tabular data

reflect-cpp also supports tabular data formats, like Parquet:
reflect-cpp also supports tabular data formats, like CSV or Parquet:

```cpp
#include <rfl/parquet.hpp>
Expand All @@ -268,9 +269,20 @@ const auto people =
.age = 45,
.email = "homer@simpson.com"}});

const auto csv_string = rfl::csv::write(people);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This CSV serialization example has some inconsistencies with the surrounding documentation that could be confusing for users:

  1. The code block above is missing the required #include <rfl/csv.hpp>.
  2. The Person struct being serialized here is implicitly the one from the "More Comprehensive Example". That struct is not compatible with the CSV output shown below because it uses rfl::Rename to produce camelCase names (e.g., firstName) and contains a std::vector<Person> children field, which is not supported in tabular formats.

To improve clarity, it would be best to define a new, flat Person struct for this tabular data section that is compatible with CSV and matches the generated output.

const auto bytestring = rfl::parquet::write(people);
```

This will resulting CSV will look like this:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a small typo in this sentence.

Suggested change
This will resulting CSV will look like this:
The resulting CSV will look like this:


```
"first_name";"last_name";"town";"birthday";"age";"email"
"Bart";"Simpson";"Springfield";1987-04-19;10;"bart@simpson.com"
"Lisa";"Simpson";"Springfield";1987-04-19;8;"lisa@simpson.com"
"Maggie";"Simpson";"Springfield";1987-04-19;0;"maggie@simpson.com"
"Homer";"Simpson";"Springfield";1987-04-19;45;"homer@simpson.com"
```
Comment on lines +279 to +284

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The CSV output shown here uses semicolons (;) as delimiters. However, the code rfl::csv::write(people) uses default settings, which will produce standard comma-separated values. This mismatch could be confusing. To make the example consistent, please change the delimiter in the output to a comma.

Suggested change
"first_name";"last_name";"town";"birthday";"age";"email"
"Bart";"Simpson";"Springfield";1987-04-19;10;"bart@simpson.com"
"Lisa";"Simpson";"Springfield";1987-04-19;8;"lisa@simpson.com"
"Maggie";"Simpson";"Springfield";1987-04-19;0;"maggie@simpson.com"
"Homer";"Simpson";"Springfield";1987-04-19;45;"homer@simpson.com"
```
"first_name","last_name","town","birthday","age","email"
"Bart","Simpson","Springfield",1987-04-19,10,"bart@simpson.com"
"Lisa","Simpson","Springfield",1987-04-19,8,"lisa@simpson.com"
"Maggie","Simpson","Springfield",1987-04-19,0,"maggie@simpson.com"
"Homer","Simpson","Springfield",1987-04-19,45,"homer@simpson.com"


### Error messages

reflect-cpp returns clear and comprehensive error messages:
Expand Down
Loading