Closed johnstairs closed 7 months ago
Another problem is that the dtype for
[null, int, float]
should benp.object_
, instead of{"has_value": np.bool, "value": np.object_}
I see that's the intended behavior, but why is that?
We currently convert yardl type [null, int, float]
into Python type typing.Optional[Int32OrString]
, so I would expect the dtype to be {"has_value": np.bool, "value": np.object_}
I see that's the intended behavior, but why is that?
When the value is a python object pointer, there isn't much to be gained by wrapping it in a has_value/value structured array, since the pointer can just be None. But I realize we do this in other cases, for instance an optional string.
Given the following model on commit 42be458d779dc0eb0185b6c5b74278a7d06bfa7b:
We get the following exception when importing the generated code:
Another problem is that the dtype for
[null, int, float]
should benp.object_
, instead of{"has_value": np.bool, "value": np.object_}
Another problem is that the generated union classes that do not have a named type (e.g.
Int32OrString
) are not recognized byget_dtype()
and throw.