To reproduce, generate Python for this model, then import the generated Python module and create an instance of MyRecord with no arguments.
Python will complain that MyRecord.__init__() is missing the keyword argument for my_field:
Python 3.11.3 | packaged by conda-forge | (main, Apr 6 2023, 08:57:19) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import issue_082
>>> r = issue_082.MyRecord()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: MyRecord.__init__() missing 1 required keyword-only argument: 'my_field'
Using yardl commit ab1e2b with the following model:
To reproduce, generate Python for this model, then import the generated Python module and create an instance of MyRecord with no arguments. Python will complain that
MyRecord.__init__()
is missing the keyword argument formy_field
:The generated code for
MyRecord
looks like this:If I remove the
AliasedRecord
from the model and useGenericRecord
directly, I get the expected class definition forMyRecord
, and it works:The relevant code is https://github.com/microsoft/yardl/blob/ae9b826d94a88c3640002839e9ded57ce3ab1e2b/tooling/internal/python/types/types.go#L179-L195