Generation raises and index out of range when not all includes are provided
skinkie opened this issue · 4 comments
wget https://data.ndovloket.nl/docs/infoplus/RIT/ndov-ri-cdm-rit-v2.10.xsd
xsdata generate -p ritinfo ndov-ri-cdm-rit-v2.10.xsd
notice:
self.copy_attribute_properties(source, target, attr, attr_type)
File "/mnt/storage/home/skinkie/Sources/references/venv/lib/python3.11/site-packages/xsdata/codegen/handlers/process_attributes_types.py", line 233, in copy_attribute_properties
source_attr = source.attrs[0]
~~~~~~~~~~~~^^^
Add the required dependency:
wget https://data.ndovloket.nl/docs/infoplus/RIT/ndov-ri-cdm-common-v2.5.xsd
Generation works.
Expected change, raise some issue about missing files to prevent the error from happening?
Fixed the underlying issue, the generator should now finish with a bunch of warnings.
========= xsdata v24.6.1 / Python 3.11.8 / Platform linux =========
Parsing schema file:///home/chris/projects/xsdata/ndov-ri-cdm-rit-v2.10.xsd
Compiling schema file:///home/chris/projects/xsdata/ndov-ri-cdm-rit-v2.10.xsd
Builder: 21 main and 0 inner classes
Analyzer input: 21 main and 0 inner classes
Analyzer output: 17 main and 0 inner classes
Generating package: init
Generating package: ritinfo.ndov_ri_cdm_rit_v2_10
Warnings: 75
warning: Resource not found file:///home/chris/projects/xsdata/ndov-ri-cdm-common-v2.5.xsd
warning: Missing extension type: indicatie
warning: Reset absent type: ReisInformatieProductIDType
warning: Reset absent type: treinnummer
warning: Reset absent type: TreinDatumType
warning: Reset absent type: TreinNaamType
....
Btw xsdata has its own download utility to fetch locally schemas recursively, no need to use wget
https://xsdata.readthedocs.io/en/latest/codegen/download_schemas/
Warnings: 75
warning: Resource not found file:///home/chris/projects/xsdata/ndov-ri-cdm-common-v2.5.xsd
warning: Missing extension type: indicatie
warning: Reset absent type: ReisInformatieProductIDType
warning: Reset absent type: treinnummer
warning: Reset absent type: TreinDatumType
warning: Reset absent type: TreinNaamType
I think it might be safer to have the option to raise an error in this instance, especially for automatic toolchains.
Warnings: 75
warning: Resource not found file:///home/chris/projects/xsdata/ndov-ri-cdm-common-v2.5.xsd
warning: Missing extension type: indicatie
warning: Reset absent type: ReisInformatieProductIDType
warning: Reset absent type: treinnummer
warning: Reset absent type: TreinDatumType
warning: Reset absent type: TreinNaamTypeI think it might be safer to have the option to raise an error in this instance, especially for automatic toolchains.
I wish, we could, but apparently w3c xsd tests suite expects binding libraries to be able to recover from absent types.
I think it might be safer to have the option to raise an error in this instance, especially for automatic toolchains.
I wish, we could, but apparently w3c xsd tests suite expects binding libraries to be able to recover from absent types.
Would it be possible to add a command line option to fail on absent types?