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

Handle empty entries in the stratigraphy list #383

Closed
perolavsvendsen opened this issue Oct 27, 2023 · 2 comments
Closed

Handle empty entries in the stratigraphy list #383

perolavsvendsen opened this issue Oct 27, 2023 · 2 comments

Comments

@perolavsvendsen
Copy link
Member

perolavsvendsen commented Oct 27, 2023

If user puts empty entries in the stratigraphy in global_variables, e.g.:

MyFormation:
  stratigraphic: True
  name: My Fm. Top
  alias:
    - MyFormation
    - OtherAlias
    -                   # <-- PROBLEM!
  stratigraphic_alias:
    - Some GP. Top
    - SomeOther GP. Base   
    -                   # <-- PROBLEM!

---> This will currently export with null in outgoing metadata. In validation, it is expected to be string hence not validated. Tricky to debug. fmu-dataio should catch this and either warn or ignore or both.

Originally posted by @perolavsvendsen in #373 (comment)

Suggested solution:

  • fmu-dataio gives warning when empty entries are detected, then ignores them
@perolavsvendsen
Copy link
Member Author

Partial (?) solution in #386. However, does not ignore them - just warns.

A reflection: The whole validation of the config should probably be improved. This seems like a task for jsonschema or Pydantic or similar, and do proper validation of the config.

I tried jsonschema, but abandoned it for two reason:

  • The nature of the "stratigraphy" block, with the custom keys, is not ideal for jsonschema
  • The error messages coming out of json schema are too sparse to be informative to end user. E.g. if an empty entry is detected, it will not validate with a message that looks something like: "null is not a string".

Instead of validating the whole config in one go, we can create schemas for each entry, and check them one-by-one. That will enable us to add more meaningful information to the error messages.

@mferrera
Copy link
Collaborator

Closed in lieu of having completed the move to Pydantic which does this sort of validation.

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

No branches or pull requests

2 participants