yamale allows us to neatly code up a schema to validate the structure of the configuration YAML.
The [0][0] thing is a little funky, but it seemed to be the only way I could tell to get the parsed config file.
This ensures that any class with a from_cfg static method, which indicates that it's loaded from the configuration YAML, will have the required fields, appropriate values, etc., so there's no need to worry in doing any **kwargs magic (if it applies to the configuration file).
To ensure total YAML validation (beyond structure), I think the final thing left to do is to validate that all monsters referenced in the map definitions actually exist in the YAML. It might be possible to do this sort of check with Yamale.
The document preceding the --- describes the base schema, ie. the outermost members of the YAML. The document following describes the includes, which are any custom non-default types (default example would be int), which may or may not be nested. Custom type definitions cannot be included in the base schema.
yamale
allows us to neatly code up a schema to validate the structure of the configuration YAML.The
[0][0]
thing is a little funky, but it seemed to be the only way I could tell to get the parsed config file.This ensures that any class with a
from_cfg
static method, which indicates that it's loaded from the configuration YAML, will have the required fields, appropriate values, etc., so there's no need to worry in doing any**kwargs
magic (if it applies to the configuration file).To ensure total YAML validation (beyond structure), I think the final thing left to do is to validate that all monsters referenced in the map definitions actually exist in the YAML. It might be possible to do this sort of check with Yamale.
The document preceding the
---
describes the base schema, ie. the outermost members of the YAML. The document following describes the includes, which are any custom non-default types (default example would beint
), which may or may not be nested. Custom type definitions cannot be included in the base schema.Implements #18