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

subclassing support for type_hooks #255

Open
maticus opened this issue May 17, 2024 · 1 comment
Open

subclassing support for type_hooks #255

maticus opened this issue May 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@maticus
Copy link

maticus commented May 17, 2024

The 'cast' option has subclassing support:

It also works with base classes - if T is a base class of type S, all fields of type S will be also "casted".

I'd love to see this in type_hooks as well.

One concrete use case that I have is I'd like to create Enums using their members' names (not values).

@maticus maticus added the enhancement New feature or request label May 17, 2024
@tiagobonetti
Copy link

I second that.

I currently use a decorator to register enums to the hooks individually but that adds unnecessary shared state that could be removed.

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

No branches or pull requests

2 participants