Skip to content

Commit

Permalink
chore: validate early
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
  • Loading branch information
aarnphm committed Sep 27, 2022
1 parent a666072 commit 00fcd91
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bentoml/_internal/configuration/containers.py
Expand Up @@ -225,6 +225,14 @@ def __init__(
)
with open(default_config_file, "rb") as f:
self.config: t.Dict[str, t.Any] = yaml.safe_load(f)
if validate_schema:
try:
SCHEMA.validate(self.config)
except SchemaError as e:
raise BentoMLConfigException(
"Default configuration 'default_configuration.yml' does not"
" conform to the required schema."
) from e

# User override configuration
if override_config_file is not None:
Expand Down

0 comments on commit 00fcd91

Please sign in to comment.