haddocking / haddock3

Official repo of the modular BioExcel version of HADDOCK
https://www.bonvinlab.org/haddock3
Apache License 2.0
101 stars 33 forks source link

Validate YAML schema and format in parameter files #911

Closed rvhonorato closed 3 weeks ago

rvhonorato commented 3 months ago

Description

The modules use a .yaml file to define its parameters - however their format and schema are not validated on loading.

So it's possible to add repeated parameters or parameters missing specific fields.

Since the schema is not validated, you will only observe errors at runtime, in a specific module, in a specific condition.

Describe the solution you'd like

libio.read_from_yaml should be refactored to do a schema/format validation;

https://github.com/haddocking/haddock3/blob/48f59fbb875faf67646346964184cffd160f1e9e/src/haddock/libs/libio.py#L87

Additional context

There is no built-in python way of doing this faik, but there are several third-party librares for this such as pydantic-yaml and strictyaml