Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mishamsk
Copy link

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:

  • Wire the new allow_tagged_struct_subtypes kwarg into json, msg pack decoders
  • Properly handle type node / struct info caching. As of now, cache doesn't account for allow_tagged_struct_subtypes, so it will not honor the flag after decoder (type node) is cached for the first time
  • Add more tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant