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

SerdeError: Unsupported type when subclass is member of dataclass #478

Closed
davetapley opened this issue Feb 22, 2024 · 2 comments
Closed
Labels
bug Bug report or fix

Comments

@davetapley
Copy link
Contributor

For reasons I have something like this:

from pathlib import PosixPath

class Test(PosixPath):
    ...

It works just fine on its own:

from serde.json import to_json

t = Test('.')
print(to_json(t))

# "."

But when a member of another dataclass I get SerdeError:

@dataclass
class B:
    p: Test

b = B(Test('.'))
print(to_json(b))

# serde.compat.SerdeError: Unsupported type: Test

Full repro: https://gist.github.com/davetapley/8c71c2918cd587442f3af7a1e4a24c40

@davetapley
Copy link
Contributor Author

For now I can workaround with custom add_serializer / add_deserializer.

@yukinarit yukinarit added the bug Bug report or fix label Feb 28, 2024
@davetapley
Copy link
Contributor Author

FYI this example is now broken due to:

@davetapley davetapley closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or fix
Projects
None yet
Development

No branches or pull requests

2 participants