getml / reflect-cpp

A C++20 library for fast serialization, deserialization and validation using reflection. Supports JSON, BSON, CBOR, flexbuffers, msgpack, TOML, XML, YAML / msgpack.org[C++20]
https://getml.github.io/reflect-cpp/
MIT License
901 stars 76 forks source link

Support for MsgPack using msgpack-c #26

Closed liuzicheng1987 closed 4 months ago

liuzicheng1987 commented 8 months ago

MsgPack (https://msgpack.org/) is a JSON-like binary format that claims to be faster and smaller than JSON, because it is a binary.

The canonical implementation is in C and there is an official C++ interface (https://github.com/msgpack/msgpack-c/tree/c_master).

To me, this seems like a great contribution. It is a very popular serialization format that is supported by many languages. I think people would like to see a reflection-based interface for this.

Generally speaking, any serialization format can be integrated by implementing the IsReader and IsWriter concepts, which are documented here: https://github.com/getml/reflect-cpp/blob/main/docs/supporting_your_own_format.md. The way I see it, it should be fairly straightforward to implement these concepts for msgpack-c. (msgpack-cpp seems a bit harder.)

You should implement tests for this, in the same way the tests are set up for flexbuffers - by providing a Dockerfile that contains a reproducible environment in which the tests can be compiled and run:

https://github.com/getml/reflect-cpp/tree/main/tests/flexbuffers

liuzicheng1987 commented 8 months ago

@zerolfx, I have noticed that you have forked the repository. Is it your intention to contribute the msgpack interface?

If yes, such a PR would be very welcome. If you have any questions, please do not hesitate to reach out to me. You can find me on Reddit (user name liuzicheng1987) or LinkedIn (Dr. Patrick Urbanke).

If no, I would implement it myself, most likely in Q1 2024.

zerolfx commented 8 months ago

Yes, I'll give it a shot.