You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having user defined types with names like Optional will make Python unable to use the typing.Optional type since it is from imported.
Not importing typing.Optional but instead using it with the full module prefix would fix this.
The same would happen with Enum, Any, or List.
Shame that this is unmaintained, I would not mind making a PR for this since it's a simple fix.
Creating this issue so that others will realize their issue faster.
Traceback (most recent call last):
File "/media/asd/96B4-13F2/jtdc/t.py", line 7, in <module>
t = model.Schema.from_json_data(data)
File "/media/asd/96B4-13F2/jtdc/model.py", line 18, in from_json_data
_from_json_data(Optional[str], data.get("t")),
TypeError: 'type' object is not subscriptable
The text was updated successfully, but these errors were encountered:
Having user defined types with names like
Optional
will make Python unable to use thetyping.Optional
type since it is from imported.Not importing
typing.Optional
but instead using it with the full module prefix would fix this.The same would happen with
Enum
,Any
, orList
.Shame that this is unmaintained, I would not mind making a PR for this since it's a simple fix.
Creating this issue so that others will realize their issue faster.
With the following schema:
Running
jtd-codegen --python-out . schema.json
creates the following:Running it with
causes
The text was updated successfully, but these errors were encountered: