Open
Description
Description
I want to define JSON fields.
I thus use the following code.
import msgspec
import uuid
from typing import TypeAlias
t_JSON: TypeAlias = dict[str, "t_JSON"] | list["t_JSON"] | str | int | float | bool | None
class t_1(msgspec.Struct):
n: int
uid: uuid.UUID
jdata: t_JSON
print('Version:', msgspec.__version__)
msgspec.inspect.type_info(t_1)
and it issues an exception (I don't know if it's actually a bug):
Version: 0.19.0
Traceback (most recent call last):
File "c:\program files\wing pro 10\bin\dbg\src\debug\tserver\dbgutils.py", line 2334, in to_trace
Python Shell, prompt 6, line 1
msgspec.inspect.type_info(t_1)
File "d:\python\python312\lib\site-packages\msgspec\inspect.py", line 629, in type_info
return multi_type_info([type])[0]
File "d:\python\python312\lib\site-packages\msgspec\inspect.py", line 598, in multi_type_info
return _Translator(types).run()
File "d:\python\python312\lib\site-packages\msgspec\inspect.py", line 744, in run
MsgpackDecoder(Tuple[self.types])
builtins.TypeError: Type 'ForwardRef('t_JSON')' is not supported```
Metadata
Metadata
Assignees
Labels
No labels