Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMI stops on errors and lacks meaningful output #40

Open
nesnoj opened this issue Sep 24, 2021 · 1 comment
Open

OMI stops on errors and lacks meaningful output #40

nesnoj opened this issue Sep 24, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@nesnoj
Copy link

nesnoj commented Sep 24, 2021

We use the OMI tool in eGon-data to check the metadata. It is quite helpful but lacks some speaking output:

  • Optional keys do not seem to be checked, a warning would be helpful Missing Parser Warning for Missing Keys #35
  • If there's an error (more precise: some format problem, e.g. mandatory key is missing) while processing, OMI immediately stops e.g. stating omi.dialects.base.parser.ParserException: metadata string does not contain an id. In my opinion it'd be better to parse the entire metadata and give a list of errors/warnings, otherwise one might end up in a trial-and-error odyssey.
  • Lacking details where error is located: e.g. if there's a malformed string OMI prints dateutil.parser._parser.ParserError: String does not contain a date:. Pardon, which field?
@henhuy
Copy link

henhuy commented Jun 18, 2024

* Optional keys do not seem to be checked, a warning would be helpful [Missing Parser Warning for Missing Keys #35](https://github.com/OpenEnergyPlatform/omi/issues/35)

Added check for optional fields, which will raise a warning if missing

* If there's an error (more precise: some format problem, e.g. mandatory key is missing) while processing, OMI immediately stops e.g. stating `omi.dialects.base.parser.ParserException: metadata string does not contain an id`. In my opinion it'd be better to parse the entire metadata and give a list of errors/warnings, otherwise one might end up in a trial-and-error odyssey.

Currently, there are four validation steps:

  • Parse metadata from JSON string
  • Check metadata based on JSONschema
  • Check license
  • Check optional fields (only warnings, no errors)

If there is an error in one of this steps, validation will stop an throw an error - I don't see how this can be changed (if JSON cannot be read, you don't get a dict, you cannot go on...). BUT, I think JSONschema bundles its error messages, so at least you will have a single error for all schema violations.
So I think you will have to live, with some stages of error and no one error-message for all issues in your metadata file...

* Lacking details where error is located: e.g. if there's a malformed string OMI prints `dateutil.parser._parser.ParserError: String does not contain a date:`. Pardon, which field?

I think JSONschema gives more meaningful error messages...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants