Instead of hard coding default values for each field within the function, we can use the schema itself to set default values for missing fields in the document. The cerberus python package provides normalization rules which support this functionality. This approach would also lets us change default values for specific fields in the future without breaking the test suite.
The
read_optional_key
function was added in PR https://github.com/CABLE-LSM/benchcab/pull/238:https://github.com/CABLE-LSM/benchcab/blob/5c526e45ad094c6b024eb41586f34b3e628a5610/src/benchcab/config.py#L74-L121
Instead of hard coding default values for each field within the function, we can use the schema itself to set default values for missing fields in the document. The cerberus python package provides normalization rules which support this functionality. This approach would also lets us change default values for specific fields in the future without breaking the test suite.