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

Missing Parser Warning for Undefined Keys #36

Open christian-rli opened 4 years ago

christian-rli commented 4 years ago

When parsing a metadata string, omi seems to just look for a few mandatory keys and accepts what comes with it. Keys that aren't defined in the metadata standard don't trigger a warning and are simply ignored. A warning would be quite helpful, for example in case a key was misspelled.

SharanyaMohan-30 commented 3 years ago

@christian-rli
Currently, I am working on this ticket need few details from your end. As per the mentioned description related to warning, should we need to raise the exception for undefined keys and stop parsing or Should I log the warning and continue parsing?

christian-rli commented 3 years ago

Hi @SharanyaMohan-30 thank you for taking up the issue! I think omi should only fail to parse when it really needs to. So if there are undefined keys I think there should be a warning, but parsing can continue. In this case you can also print out the keys that are missing, because they are expected from the standard, so a potential typo would become obvious to the user. Always printing out missing keys would be an option, but users would probably ignore output soon after implementing this, because basically all keys are optional. Maybe add a verbose option, but I'm making this issue bigger than it is. For now, just keep on parsing :)