OpenEnergyPlatform / omi

Repository for the Open Metadata Integration (OMI). For metadata definition see metadata repo:
https://github.com/OpenEnergyPlatform/metadata
GNU Affero General Public License v3.0
7 stars 4 forks source link

Compiling metadata with minimum or empty fields causes a NoneType error. #73

Closed jh-RLI closed 1 year ago

jh-RLI commented 1 year ago

Using metadata json structures that do not provide all fields of the oemetadata spec. are not handled as expected by OMI. For most fields this will not raise any braking errors but with the latest version of OMI (0.0.8) the _comment field was added to the OEMetadata class as keyword-argument reading the values from the input metadata. If the _comment field is empty in the input this will cause a breaking error when trying to compile from a metadata json/dict.

Example meta = {"id": self.test_table}

using omi to compile then raises:

File "/home/runner/work/oeplatform/oeplatform/.tox/py3/lib/python3.8/site-packages/omi/dialects/oep/compiler.py", line 372, in visit_metadata
    metadata=metadata.comment.metadata_info,
AttributeError: 'NoneType' object has no attribute 'metadata_info'