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
Hi there,
Why doesn't it work as imagined, especially in the second stage?
from datetime import datetime import msgspec element = { "id_": 1, "name": "Google", "country": "Finland", "description": None, "created_at": datetime(2025, 1, 20, 12, 28, 55), "updated_at": datetime(2025, 1, 20, 18, 58, 42), } # Stage ONE class _FooOne(msgspec.Struct): id_: int created_at: datetime updated_at: datetime class _BarOne(msgspec.Struct): name: str country: str description: str | None # class SchemaOne(msgspec.Struct, _FooOne, _BarOne): # ! TypeError # pass # Stage TWO class _FooTwo: id_: int created_at: datetime updated_at: datetime class _BarTwo: name: str country: str description: str | None class SchemaTwo(_FooTwo, _BarTwo, msgspec.Struct): pass # Stage THREE class _FooThree(msgspec.Struct): id_: int created_at: datetime updated_at: datetime class _BarThree(_FooThree): name: str country: str description: str | None class SchemaThree(_BarThree): pass print(msgspec.convert(element, type=SchemaTwo)) # ! Empty print(msgspec.convert(element, type=SchemaThree)) # ! Ok
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Hi there,
Why doesn't it work as imagined, especially in the second stage?
The text was updated successfully, but these errors were encountered: