We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've noticed that when encoding a dataclass class (as opposed to an instance), the class is encoded to an empty dict.
I was wondering if this was intentional behaviour? I would have expected an error as if I had passed in any other class (rather than instance).
>>> import msgspec.json >>> e = msgspec.json.Encoder() >>> from dataclasses import dataclass >>> @dataclass ... class SomeDataclass: ... foo: int ... >>> e.encode(SomeDataclass) b'{}' >>> class SomeClass: ... pass ... >>> e.encode(SomeClass) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Encoding objects of type type is unsupported
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Question
I've noticed that when encoding a dataclass class (as opposed to an instance), the class is encoded to an empty dict.
I was wondering if this was intentional behaviour? I would have expected an error as if I had passed in any other class (rather than instance).
The text was updated successfully, but these errors were encountered: