In our project we have the need to create typescript interfaces for complex serializers, which include the following:
Trying to create typescript interface for this serializer results in the following error:
Traceback (most recent call last):
File "/workspace/api/app/./manage_debug.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/workspace/api/.venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/workspace/api/.venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/workspace/api/.venv/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/workspace/api/.venv/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/management/commands/generate_ts.py", line 147, in handle
self._generate_ts(app_name, serializer_name, output, **options)
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/management/commands/generate_ts.py", line 114, in _generate_ts
generate_ts(
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/__init__.py", line 513, in generate_ts
interfaces_enums = __generate_interfaces_and_enums(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/__init__.py", line 416, in __generate_interfaces_and_enums
return [
^
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/__init__.py", line 417, in <listcomp>
__get_ts_interface_and_enums(
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/__init__.py", line 373, in __get_ts_interface_and_enums
ts_property, ts_type, ts_enum, ts_enum_value = __process_field(
^^^^^^^^^^^^^^^^
File "/workspace/api/.venv/lib/python3.11/site-packages/django_typomatic/__init__.py", line 248, in __process_field
if issubclass(return_type, BaseSerializer):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 1 must be a class
It would be awesome to have support for this.
In our project we have the need to create typescript interfaces for complex serializers, which include the following:
Trying to create typescript interface for this serializer results in the following error:
After some debugging I discovered, that it was because of the TODO comments topic of allowing nested iterables.
It would be awesome to have support for this.