From 75ef6577d1dece1bedce29f47482596dbc6861ff Mon Sep 17 00:00:00 2001 From: sanj <67624670+iodrift@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:15:05 -0700 Subject: [PATCH] Auto-update: Thu Aug 8 17:15:05 PDT 2024 --- sijapi/classes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sijapi/classes.py b/sijapi/classes.py index 3787f53..789351a 100644 --- a/sijapi/classes.py +++ b/sijapi/classes.py @@ -361,9 +361,11 @@ class APIConfig(BaseModel): fields[key] = (bool, value) else: raise ValueError(f"Invalid value for {key}: {value}. Must be 'on', 'off', True, or False.") - + DynamicConfig = create_model(model_name, **fields) - return DynamicConfig(**data) + instance_data = {k: (v.lower() == 'on' if isinstance(v, str) else v) for k, v in data.items()} + return DynamicConfig(**instance_data) + @classmethod def _resolve_path(cls, path: Union[str, Path], default_dir: str) -> Path: