jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
https://jcristharif.com/msgspec/
BSD 3-Clause "New" or "Revised" License
2.45k stars 76 forks source link

Draft: feat: allow converting subclasses of tagged structs #663

Open mishamsk opened 8 months ago

mishamsk commented 8 months ago

Hi,

This is a very rough draft, opening to see if @jcrist will be open for this feature/approach.

It addresses #656 and my own #541 - allowing to decode data representing a tagged struct subclass in place of the super class.

This feature prevents me from switching to msgspec in my ast library, but should be generally very usable for any tree-like structure/messages.

As of time of writing, in order for this PR to be complete, at least the following has to be handled: