atdpy treats option as nullable
mjambon opened this issue · 0 comments
mjambon commented
atdpy treats the option
type as nullable
but it should not.
The convention used by ATD is to use "None"
or ["Some", 42]
to represent int option
values in JSON. Python code generated by atdpy instead expects null
or 42
as if the type was int nullable
rather than int option
.
I don't think we need to support the option
type at all for Python since Python doesn't have a standard option type. The Optional
type known by mypy is in fact equivalent to ATD's nullable
, not option
.
Instead of emitting an error, we could create an option type for Python but it would probably be awkward. This can be done later if there's some demand for it (I doubt it will be the case).