Trying to run xsd_to_django_model on Cellosaurus version 7.00 with Python 3.11.7 and xsd_to_django_model==1.2.1:
> xsd_to_django_model.py cellosaurus.xsd /Cellosaurus
WARNING:__main__:Automatic model name: typename1. Consider adding it to TYPE_MODEL_MAP
Making model for type typename1
WARNING:__main__:Automatic model name: typename1.header. Consider adding it to TYPE_MODEL_MAP
Making model for type typename1.header
WARNING:__main__:Automatic model name: typename1.header.release. Consider adding it to TYPE_MODEL_MAP
Making model for type typename1.header.release
Done making model typename1.header.release (typename1.header.release)
WARNING:__main__:Automatic model name: typename1.header.terminology-list. Consider adding it to TYPE_MODEL_MAP
Making model for type typename1.header.terminology-list
WARNING:__main__:Automatic model name: typename1.header.terminology-list.terminology. Consider adding it to TYPE_MODEL_MAP
Making model for type typename1.header.terminology-list.terminology
Done making model typename1.header.terminology-list.terminology (typename1.header.terminology-list.terminology)
ERROR:__main__:EXCEPTION: caught maxOccurs=unbounded in typename1.header.terminology-list.terminology (@type=None). Consider adding it to many_to_many_fields, one_to_many_fields, array_fields, or json_fields
Traceback (most recent call last):
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1508, in make_a_field
rel = model.get('foreign_key_overrides', {})[name]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'header'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1508, in make_a_field
rel = model.get('foreign_key_overrides', {})[name]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'terminology-list'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 2244, in main
builder.make_models([(a.decode('UTF-8') if hasattr(a, 'decode') else a)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1860, in make_models
self.make_model('typename1', self.schema.elements[typename[1:]].type)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
self.make_fields(typename, seq_or_choice,
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
**self.make_a_field(typename, name, dotted_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1510, in make_a_field
final_type, field = self.get_field(final_type,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1004, in get_field
self.make_model(el_path, element.type)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
self.make_fields(typename, seq_or_choice,
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
**self.make_a_field(typename, name, dotted_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1510, in make_a_field
final_type, field = self.get_field(final_type,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1004, in get_field
self.make_model(el_path, element.type)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1799, in make_model
self.write_seq_or_choice(seq_or_choice, typename, attrs=attrs)
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1179, in write_seq_or_choice
self.make_fields(typename, seq_or_choice,
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1635, in make_fields
**self.make_a_field(typename, name, dotted_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/code/xsd_to_django_model/venv/bin/xsd_to_django_model.py", line 1568, in make_a_field
(max_occurs == 1) or (field.get('wrap') == "ArrayField"), (
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: caught maxOccurs=unbounded in typename1.header.terminology-list.terminology (@type=None). Consider adding it to many_to_many_fields, one_to_many_fields, array_fields, or json_fields
It looks like it encountered terminology-list's definition's maxOccurs=unbounded.
Trying to run
xsd_to_django_model
on Cellosaurus version 7.00 with Python 3.11.7 andxsd_to_django_model==1.2.1
:It looks like it encountered
terminology-list
's definition'smaxOccurs=unbounded
.What should one do for
maxOccurs=unbounded
?