Closed jcrist closed 2 years ago
I no longer think this makes sense (at least for now). With the addition of extension types (and encoder hooks), there is enough msgpack specific things in here that anything json-specific would likely best be handled in a separate repo.
Actually, I am going to reopen this. Except for msgspec.Ext
, everything here still applies to json.
It could be nice to have something like Pydantic but where the model and validation definition are completely separate from the serialization protocol so that the serialization can be a pluggable piece.
The schema handling logic and struct objects aren't MessagePack specific, and could be adopted for other protocols. This would allow an application to switch between JSON and MessagePack, while making use of the same schemas and objects throughout. I don't plan on working on this anytime soon, but adding support for JSON here isn't unreasonable. Unlike MessagePack though, parsing JSON is nontrivial, so adding support would require some care.